@nfdi4plants/arctrl 3.0.0-alpha.3 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -9
- package/dist/ts/cjs/ts/ARC.js +25 -17
- package/dist/ts/cjs/ts/Conversion.js +133 -86
- package/dist/ts/cjs/ts/Core/ArcTypes.js +1 -1
- package/dist/ts/cjs/ts/Core/Conversion.js +110 -43
- package/dist/ts/cjs/ts/Core/Helper/Collections.js +84 -1
- package/dist/ts/cjs/ts/Core/OntologyAnnotation.js +27 -23
- package/dist/ts/cjs/ts/Core/Table/ArcTable.js +234 -217
- package/dist/ts/cjs/ts/Core/Table/ArcTableAux.js +915 -235
- package/dist/ts/cjs/ts/Core/Table/ArcTables.js +12 -19
- package/dist/ts/cjs/ts/Core/Table/CompositeColumn.js +4 -2
- package/dist/ts/cjs/ts/FileSystem/DefaultGitattributes.js +1 -1
- package/dist/ts/cjs/ts/Json/Decode.js +105 -0
- package/dist/ts/cjs/ts/Json/Encode.js +42 -0
- package/dist/ts/cjs/ts/Json/StringTable.js +9 -2
- package/dist/ts/cjs/ts/Json/Table/ArcTable.js +100 -113
- package/dist/ts/cjs/ts/Json/Table/CellTable.js +2 -2
- package/dist/ts/cjs/ts/Json/Table/OATable.js +2 -2
- package/dist/ts/cjs/ts/JsonIO/Table/Compression.js +4 -11
- package/dist/ts/cjs/ts/ROCrate/Generic/LabProcess.js +1 -1
- package/dist/ts/cjs/ts/ROCrate/LDContext.js +92 -54
- package/dist/ts/cjs/ts/Spreadsheet/AnnotationTable/ArcTable.js +15 -4
- package/dist/ts/cjs/ts/Spreadsheet/AnnotationTable/CompositeColumn.js +77 -6
- package/dist/ts/cjs/ts/Spreadsheet/ArcInvestigation.js +31 -15
- package/dist/ts/cjs/ts/Spreadsheet/DataMapTable/DataMapHeader.js +1 -1
- package/dist/ts/cjs/ts/Spreadsheet/Metadata/SparseTable.js +2 -5
- package/dist/ts/esm/ts/ARC.js +28 -20
- package/dist/ts/esm/ts/Conversion.js +137 -90
- package/dist/ts/esm/ts/Core/ArcTypes.js +1 -1
- package/dist/ts/esm/ts/Core/Conversion.js +112 -45
- package/dist/ts/esm/ts/Core/Helper/Collections.js +73 -1
- package/dist/ts/esm/ts/Core/OntologyAnnotation.js +29 -25
- package/dist/ts/esm/ts/Core/Table/ArcTable.js +243 -226
- package/dist/ts/esm/ts/Core/Table/ArcTableAux.js +907 -246
- package/dist/ts/esm/ts/Core/Table/ArcTables.js +15 -22
- package/dist/ts/esm/ts/Core/Table/CompositeColumn.js +5 -3
- package/dist/ts/esm/ts/FileSystem/DefaultGitattributes.js +1 -1
- package/dist/ts/esm/ts/Json/Decode.js +105 -3
- package/dist/ts/esm/ts/Json/Encode.js +42 -2
- package/dist/ts/esm/ts/Json/StringTable.js +10 -3
- package/dist/ts/esm/ts/Json/Table/ArcTable.js +108 -121
- package/dist/ts/esm/ts/Json/Table/CellTable.js +2 -2
- package/dist/ts/esm/ts/Json/Table/OATable.js +2 -2
- package/dist/ts/esm/ts/JsonIO/Table/Compression.js +4 -11
- package/dist/ts/esm/ts/ROCrate/Generic/LabProcess.js +1 -1
- package/dist/ts/esm/ts/ROCrate/LDContext.js +106 -66
- package/dist/ts/esm/ts/Spreadsheet/AnnotationTable/ArcTable.js +17 -7
- package/dist/ts/esm/ts/Spreadsheet/AnnotationTable/CompositeColumn.js +78 -9
- package/dist/ts/esm/ts/Spreadsheet/ArcInvestigation.js +33 -17
- package/dist/ts/esm/ts/Spreadsheet/DataMapTable/DataMapHeader.js +1 -1
- package/dist/ts/esm/ts/Spreadsheet/Metadata/SparseTable.js +3 -6
- package/dist/ts/types/ts/ARC.d.ts +2 -2
- package/dist/ts/types/ts/ARC.d.ts.map +1 -1
- package/dist/ts/types/ts/Conversion.d.ts +17 -18
- package/dist/ts/types/ts/Conversion.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/ArcTypes.d.ts +2 -0
- package/dist/ts/types/ts/Core/ArcTypes.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/Conversion.d.ts +14 -15
- package/dist/ts/types/ts/Core/Conversion.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/Helper/Collections.d.ts +11 -0
- package/dist/ts/types/ts/Core/Helper/Collections.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/OntologyAnnotation.d.ts +9 -0
- package/dist/ts/types/ts/Core/OntologyAnnotation.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/Table/ArcTable.d.ts +35 -28
- package/dist/ts/types/ts/Core/Table/ArcTable.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/Table/ArcTableAux.d.ts +84 -33
- package/dist/ts/types/ts/Core/Table/ArcTableAux.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/Table/ArcTables.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/Table/CompositeColumn.d.ts.map +1 -1
- package/dist/ts/types/ts/FileSystem/DefaultGitattributes.d.ts +1 -1
- package/dist/ts/types/ts/FileSystem/DefaultGitattributes.d.ts.map +1 -1
- package/dist/ts/types/ts/Json/Decode.d.ts +6 -0
- package/dist/ts/types/ts/Json/Decode.d.ts.map +1 -1
- package/dist/ts/types/ts/Json/Encode.d.ts +2 -0
- package/dist/ts/types/ts/Json/Encode.d.ts.map +1 -1
- package/dist/ts/types/ts/Json/StringTable.d.ts.map +1 -1
- package/dist/ts/types/ts/Json/Table/ArcTable.d.ts +4 -3
- package/dist/ts/types/ts/Json/Table/ArcTable.d.ts.map +1 -1
- package/dist/ts/types/ts/Json/Table/CellTable.d.ts.map +1 -1
- package/dist/ts/types/ts/Json/Table/OATable.d.ts.map +1 -1
- package/dist/ts/types/ts/JsonIO/Table/Compression.d.ts.map +1 -1
- package/dist/ts/types/ts/ROCrate/LDContext.d.ts +3 -5
- package/dist/ts/types/ts/ROCrate/LDContext.d.ts.map +1 -1
- package/dist/ts/types/ts/Spreadsheet/AnnotationTable/ArcTable.d.ts +5 -0
- package/dist/ts/types/ts/Spreadsheet/AnnotationTable/ArcTable.d.ts.map +1 -1
- package/dist/ts/types/ts/Spreadsheet/AnnotationTable/CompositeColumn.d.ts +7 -0
- package/dist/ts/types/ts/Spreadsheet/AnnotationTable/CompositeColumn.d.ts.map +1 -1
- package/dist/ts/types/ts/Spreadsheet/ArcInvestigation.d.ts.map +1 -1
- package/dist/ts/types/ts/Spreadsheet/Metadata/SparseTable.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,72 +1,492 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
3
|
+
exports.ArcTableValues = exports.ColumnValueRefs = void 0;
|
|
4
|
+
exports.getEmptyCellForHeader = getEmptyCellForHeader;
|
|
5
|
+
exports.ensureCellHashInValueMap = ensureCellHashInValueMap;
|
|
6
|
+
exports.ColumnValueRefs_Constant = ColumnValueRefs_Constant;
|
|
7
|
+
exports.ColumnValueRefs_Sparse = ColumnValueRefs_Sparse;
|
|
8
|
+
exports.ColumnValueRefs_$reflection = ColumnValueRefs_$reflection;
|
|
9
|
+
exports.ColumnValueRefs__get_RowCount = ColumnValueRefs__get_RowCount;
|
|
10
|
+
exports.ColumnValueRefs__Copy = ColumnValueRefs__Copy;
|
|
11
|
+
exports.ColumnValueRefs__ToSparse_Z524259A4 = ColumnValueRefs__ToSparse_Z524259A4;
|
|
12
|
+
exports.ColumnValueRefs__AsSparse = ColumnValueRefs__AsSparse;
|
|
13
|
+
exports.ColumnValueRefs__AsConstant = ColumnValueRefs__AsConstant;
|
|
14
|
+
exports.ColumnValueRefs_fromCellColumn_14896151 = ColumnValueRefs_fromCellColumn_14896151;
|
|
15
|
+
exports.ColumnValueRefs__ToCellColumn_Z2609C9DD = ColumnValueRefs__ToCellColumn_Z2609C9DD;
|
|
16
|
+
exports.ArcTableValues_$reflection = ArcTableValues_$reflection;
|
|
17
|
+
exports.ArcTableValues_$ctor_39436F7C = ArcTableValues_$ctor_39436F7C;
|
|
6
18
|
exports.$007CIsUniqueExistingHeader$007C_$007C = $007CIsUniqueExistingHeader$007C_$007C;
|
|
7
19
|
exports.tryFindDuplicateUnique = tryFindDuplicateUnique;
|
|
8
20
|
exports.tryFindDuplicateUniqueInArray = tryFindDuplicateUniqueInArray;
|
|
9
21
|
exports.SanityChecks_validateColumnIndex = SanityChecks_validateColumnIndex;
|
|
10
22
|
exports.SanityChecks_validateRowIndex = SanityChecks_validateRowIndex;
|
|
11
23
|
exports.SanityChecks_validateColumn = SanityChecks_validateColumn;
|
|
12
|
-
exports.
|
|
24
|
+
exports.SanityChecks_validateCellColumns = SanityChecks_validateCellColumns;
|
|
25
|
+
exports.SanityChecks_validateArcTableValues = SanityChecks_validateArcTableValues;
|
|
13
26
|
exports.Unchecked_tryGetCellAt = Unchecked_tryGetCellAt;
|
|
27
|
+
exports.Unchecked_getCellWithDefault = Unchecked_getCellWithDefault;
|
|
14
28
|
exports.Unchecked_setCellAt = Unchecked_setCellAt;
|
|
15
|
-
exports.
|
|
29
|
+
exports.Unchecked_removeCellAt = Unchecked_removeCellAt;
|
|
16
30
|
exports.Unchecked_moveCellTo = Unchecked_moveCellTo;
|
|
17
31
|
exports.Unchecked_removeHeader = Unchecked_removeHeader;
|
|
18
32
|
exports.Unchecked_removeColumnCells = Unchecked_removeColumnCells;
|
|
19
33
|
exports.Unchecked_removeColumnCells_withIndexChange = Unchecked_removeColumnCells_withIndexChange;
|
|
20
34
|
exports.Unchecked_removeRowCells = Unchecked_removeRowCells;
|
|
21
35
|
exports.Unchecked_removeRowCells_withIndexChange = Unchecked_removeRowCells_withIndexChange;
|
|
22
|
-
exports.
|
|
36
|
+
exports.Unchecked_removeRowRange_withIndexChange = Unchecked_removeRowRange_withIndexChange;
|
|
37
|
+
exports.Unchecked_moveColumnCellsTo = Unchecked_moveColumnCellsTo;
|
|
38
|
+
exports.Unchecked_addRefColumn = Unchecked_addRefColumn;
|
|
23
39
|
exports.Unchecked_addColumn = Unchecked_addColumn;
|
|
40
|
+
exports.Unchecked_addColumnFill = Unchecked_addColumnFill;
|
|
24
41
|
exports.Unchecked_fillMissingCells = Unchecked_fillMissingCells;
|
|
25
|
-
exports.
|
|
42
|
+
exports.Unchecked_addEmptyRow = Unchecked_addEmptyRow;
|
|
26
43
|
exports.Unchecked_addRow = Unchecked_addRow;
|
|
27
44
|
exports.Unchecked_addRows = Unchecked_addRows;
|
|
28
45
|
exports.Unchecked_compositeHeaderMainColumnEqual = Unchecked_compositeHeaderMainColumnEqual;
|
|
29
46
|
exports.Unchecked_moveColumnTo = Unchecked_moveColumnTo;
|
|
30
47
|
exports.Unchecked_alignByHeaders = Unchecked_alignByHeaders;
|
|
48
|
+
const CompositeCell_js_1 = require("./CompositeCell.js");
|
|
31
49
|
const Int32_js_1 = require("@fable-org/fable-library-js/Int32.js");
|
|
32
|
-
const
|
|
50
|
+
const Option_js_1 = require("@fable-org/fable-library-js/Option.js");
|
|
33
51
|
const Util_js_1 = require("@fable-org/fable-library-js/Util.js");
|
|
34
|
-
const CompositeCell_js_1 = require("./CompositeCell.js");
|
|
35
52
|
const MapUtil_js_1 = require("@fable-org/fable-library-js/MapUtil.js");
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
53
|
+
const Types_js_1 = require("@fable-org/fable-library-js/Types.js");
|
|
54
|
+
const Reflection_js_1 = require("@fable-org/fable-library-js/Reflection.js");
|
|
55
|
+
const Seq_js_1 = require("@fable-org/fable-library-js/Seq.js");
|
|
39
56
|
const Collections_js_1 = require("../Helper/Collections.js");
|
|
57
|
+
const String_js_1 = require("@fable-org/fable-library-js/String.js");
|
|
58
|
+
const Range_js_1 = require("@fable-org/fable-library-js/Range.js");
|
|
59
|
+
const List_js_1 = require("@fable-org/fable-library-js/List.js");
|
|
40
60
|
const Double_js_1 = require("@fable-org/fable-library-js/Double.js");
|
|
41
61
|
const Array_js_1 = require("@fable-org/fable-library-js/Array.js");
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Get an empty cell fitting for related column header.
|
|
64
|
+
*
|
|
65
|
+
* `columCellOption` is used to decide between `CompositeCell.Term` or `CompositeCell.Unitized`. `columCellOption` can be any other cell in the same column, preferably the first one.
|
|
66
|
+
*/
|
|
67
|
+
function getEmptyCellForHeader(header, columCellOption) {
|
|
68
|
+
const matchValue = header.IsTermColumn;
|
|
69
|
+
if (matchValue) {
|
|
70
|
+
let matchResult;
|
|
71
|
+
if (columCellOption == null) {
|
|
72
|
+
matchResult = 0;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
switch ((0, Option_js_1.value)(columCellOption).tag) {
|
|
76
|
+
case /* Term */ 0: {
|
|
77
|
+
matchResult = 0;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
case /* Unitized */ 2: {
|
|
81
|
+
matchResult = 1;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
default:
|
|
85
|
+
matchResult = 2;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
switch (matchResult) {
|
|
89
|
+
case 0:
|
|
90
|
+
return CompositeCell_js_1.CompositeCell.emptyTerm;
|
|
91
|
+
case 1:
|
|
92
|
+
return CompositeCell_js_1.CompositeCell.emptyUnitized;
|
|
93
|
+
default:
|
|
94
|
+
throw new Error("[extendBodyCells] This should never happen, IsTermColumn header must be paired with either term or unitized cell.");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
return CompositeCell_js_1.CompositeCell.emptyFreeText;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function ensureCellHashInValueMap(value, valueMap) {
|
|
102
|
+
const hash = (0, Util_js_1.safeHash)(value) | 0;
|
|
103
|
+
if (valueMap.has(hash)) {
|
|
104
|
+
return hash | 0;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
(0, MapUtil_js_1.addToDict)(valueMap, hash, value);
|
|
108
|
+
return hash | 0;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function ColumnValueRefs_Constant(Item) {
|
|
112
|
+
return new ColumnValueRefs(0, [Item]);
|
|
113
|
+
}
|
|
114
|
+
function ColumnValueRefs_Sparse(Item) {
|
|
115
|
+
return new ColumnValueRefs(1, [Item]);
|
|
116
|
+
}
|
|
117
|
+
class ColumnValueRefs extends Types_js_1.Union {
|
|
118
|
+
constructor(tag, fields) {
|
|
119
|
+
super();
|
|
120
|
+
this.tag = tag;
|
|
121
|
+
this.fields = fields;
|
|
122
|
+
}
|
|
123
|
+
cases() {
|
|
124
|
+
return ["Constant", "Sparse"];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.ColumnValueRefs = ColumnValueRefs;
|
|
128
|
+
function ColumnValueRefs_$reflection() {
|
|
129
|
+
return (0, Reflection_js_1.union_type)("ARCtrl.ArcTableAux.ColumnValueRefs", [], ColumnValueRefs, () => [[["Item", Reflection_js_1.int32_type]], [["Item", (0, Reflection_js_1.class_type)("System.Collections.Generic.Dictionary`2", [Reflection_js_1.int32_type, Reflection_js_1.int32_type])]]]);
|
|
130
|
+
}
|
|
131
|
+
function ColumnValueRefs__get_RowCount(this$) {
|
|
132
|
+
if (this$.tag === /* Sparse */ 1) {
|
|
133
|
+
return (0, Seq_js_1.maxBy)((kv) => kv[0], this$.fields[0], {
|
|
134
|
+
Compare: Util_js_1.comparePrimitives,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function ColumnValueRefs__Copy(this$) {
|
|
142
|
+
if (this$.tag === /* Sparse */ 1) {
|
|
143
|
+
const values = this$.fields[0];
|
|
144
|
+
const d = new Map([]);
|
|
145
|
+
(0, Seq_js_1.iterate)((v) => {
|
|
146
|
+
(0, MapUtil_js_1.addToDict)(d, v[0], v[1]);
|
|
147
|
+
}, values);
|
|
148
|
+
return ColumnValueRefs_Sparse(d);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
return ColumnValueRefs_Constant(this$.fields[0]);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function ColumnValueRefs__ToSparse_Z524259A4(this$, rowCount) {
|
|
155
|
+
if (this$.tag === /* Sparse */ 1) {
|
|
156
|
+
return ColumnValueRefs_Sparse(this$.fields[0]);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
const valueHash = this$.fields[0] | 0;
|
|
160
|
+
const d = new Map([]);
|
|
161
|
+
for (let i = 0; i <= (rowCount - 1); i++) {
|
|
162
|
+
(0, MapUtil_js_1.addToDict)(d, i, valueHash);
|
|
163
|
+
}
|
|
164
|
+
return ColumnValueRefs_Sparse(d);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function ColumnValueRefs__AsSparse(this$) {
|
|
168
|
+
if (this$.tag === /* Sparse */ 1) {
|
|
169
|
+
return this$.fields[0];
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
const valueHash = this$.fields[0] | 0;
|
|
173
|
+
throw new Error("Cannot convert a constant column to sparse. Use ToSparse first.");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function ColumnValueRefs__AsConstant(this$) {
|
|
177
|
+
if (this$.tag === /* Sparse */ 1) {
|
|
178
|
+
throw new Error("Cannot convert a sparse column to constant. Use ToSparse first.");
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
return this$.fields[0] | 0;
|
|
182
|
+
}
|
|
50
183
|
}
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
|
|
184
|
+
function ColumnValueRefs_fromCellColumn_14896151(column, previousRowCount, valueMap) {
|
|
185
|
+
const l = (0, Seq_js_1.length)(column) | 0;
|
|
186
|
+
const cells = new Map([]);
|
|
187
|
+
if (l === 0) {
|
|
188
|
+
return ColumnValueRefs_Sparse(cells);
|
|
54
189
|
}
|
|
55
190
|
else {
|
|
56
|
-
|
|
191
|
+
let current;
|
|
192
|
+
const hash = ensureCellHashInValueMap((0, Seq_js_1.item)(0, column), valueMap) | 0;
|
|
193
|
+
if (l >= previousRowCount) {
|
|
194
|
+
current = ColumnValueRefs_Constant(hash);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
(0, MapUtil_js_1.addToDict)(cells, 0, hash);
|
|
198
|
+
current = ColumnValueRefs_Sparse(cells);
|
|
199
|
+
}
|
|
200
|
+
(0, Seq_js_1.iterateIndexed)((i, cell) => {
|
|
201
|
+
const hash_1 = ensureCellHashInValueMap(cell, valueMap) | 0;
|
|
202
|
+
if (current.tag === /* Sparse */ 1) {
|
|
203
|
+
const cells_2 = current.fields[0];
|
|
204
|
+
cells_2.set(i, hash_1);
|
|
205
|
+
}
|
|
206
|
+
else if (current.fields[0] === hash_1) {
|
|
207
|
+
const cellHash_1 = current.fields[0] | 0;
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
const cellHash_2 = current.fields[0] | 0;
|
|
211
|
+
const cells_1 = new Map([]);
|
|
212
|
+
for (let j = 0; j <= (i - 1); j++) {
|
|
213
|
+
cells_1.set(j, cellHash_2);
|
|
214
|
+
}
|
|
215
|
+
cells_1.set(i, hash_1);
|
|
216
|
+
current = ColumnValueRefs_Sparse(cells_1);
|
|
217
|
+
}
|
|
218
|
+
}, column);
|
|
219
|
+
return current;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function ColumnValueRefs__ToCellColumn_Z2609C9DD(this$, valueMap, rowCount, header) {
|
|
223
|
+
if (this$.tag === /* Sparse */ 1) {
|
|
224
|
+
const values = this$.fields[0];
|
|
225
|
+
const defaultCell = (values.size === 0) ? getEmptyCellForHeader(header, undefined) : getEmptyCellForHeader(header, (0, MapUtil_js_1.getItemFromDict)(valueMap, (0, MapUtil_js_1.getItemFromDict)(values, (0, Seq_js_1.max)(values.keys(), {
|
|
57
226
|
Compare: Util_js_1.comparePrimitives,
|
|
58
|
-
})
|
|
227
|
+
}) - 1)));
|
|
228
|
+
return (0, Collections_js_1.ResizeArray_init)(rowCount, (i_1) => (values.has(i_1) ? (0, MapUtil_js_1.getItemFromDict)(valueMap, (0, MapUtil_js_1.getItemFromDict)(values, i_1)) : defaultCell));
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
return (0, Collections_js_1.ResizeArray_create)(rowCount, (0, MapUtil_js_1.getItemFromDict)(valueMap, this$.fields[0]));
|
|
59
232
|
}
|
|
60
233
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
234
|
+
class ArcTableValues {
|
|
235
|
+
constructor(cols, valueMap, rowCount) {
|
|
236
|
+
this._columns = cols;
|
|
237
|
+
this._valueMap = valueMap;
|
|
238
|
+
this._rowCount = (rowCount | 0);
|
|
239
|
+
}
|
|
240
|
+
get Columns() {
|
|
241
|
+
const this$ = this;
|
|
242
|
+
return this$._columns;
|
|
243
|
+
}
|
|
244
|
+
set Columns(columns) {
|
|
245
|
+
const this$ = this;
|
|
246
|
+
this$._columns = columns;
|
|
247
|
+
}
|
|
248
|
+
get ColumnCount() {
|
|
249
|
+
const this$ = this;
|
|
250
|
+
return ((0, Seq_js_1.isEmpty)(this$._columns) ? 0 : (1 + (0, Seq_js_1.max)(this$._columns.keys(), {
|
|
251
|
+
Compare: Util_js_1.comparePrimitives,
|
|
252
|
+
}))) | 0;
|
|
253
|
+
}
|
|
254
|
+
get ValueMap() {
|
|
255
|
+
const this$ = this;
|
|
256
|
+
return this$._valueMap;
|
|
257
|
+
}
|
|
258
|
+
set ValueMap(valueMap) {
|
|
259
|
+
const this$ = this;
|
|
260
|
+
this$._valueMap = valueMap;
|
|
261
|
+
}
|
|
262
|
+
get RowCount() {
|
|
263
|
+
const this$ = this;
|
|
264
|
+
return this$._rowCount | 0;
|
|
265
|
+
}
|
|
266
|
+
set RowCount(rowCount) {
|
|
267
|
+
const this$ = this;
|
|
268
|
+
if ((rowCount > 0) && (rowCount < this$._rowCount)) {
|
|
269
|
+
let enumerator = (0, Util_js_1.getEnumerator)(this$._columns);
|
|
270
|
+
try {
|
|
271
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
272
|
+
const matchValue = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]()[1];
|
|
273
|
+
if (matchValue.tag === /* Sparse */ 1) {
|
|
274
|
+
const values = matchValue.fields[0];
|
|
275
|
+
const enumerator_1 = (0, Util_js_1.getEnumerator)((0, Seq_js_1.toList)(values.keys()));
|
|
276
|
+
try {
|
|
277
|
+
while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
|
|
278
|
+
const key = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]() | 0;
|
|
279
|
+
if (key >= rowCount) {
|
|
280
|
+
values.delete(key);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
finally {
|
|
285
|
+
(0, Util_js_1.disposeSafe)(enumerator_1);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
finally {
|
|
291
|
+
(0, Util_js_1.disposeSafe)(enumerator);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
this$._rowCount = (rowCount | 0);
|
|
295
|
+
}
|
|
296
|
+
static fromCellColumns(columns) {
|
|
297
|
+
const rowCount = ((columns.length === 0) ? 0 : (0, Seq_js_1.max)((0, Collections_js_1.ResizeArray_map)((c) => c.length, columns), {
|
|
298
|
+
Compare: Util_js_1.comparePrimitives,
|
|
299
|
+
})) | 0;
|
|
300
|
+
const valueMap = new Map([]);
|
|
301
|
+
const parsedColumns = new Map([]);
|
|
302
|
+
(0, Seq_js_1.iterateIndexed)((i, column) => {
|
|
303
|
+
(0, MapUtil_js_1.addToDict)(parsedColumns, i, ColumnValueRefs_fromCellColumn_14896151(column, rowCount, valueMap));
|
|
304
|
+
}, columns);
|
|
305
|
+
return new ArcTableValues(parsedColumns, valueMap, rowCount);
|
|
306
|
+
}
|
|
307
|
+
static fromRefColumns(columns, valueMap, rowCount) {
|
|
308
|
+
const parsedColumns = new Map([]);
|
|
309
|
+
(0, Seq_js_1.iterateIndexed)((i, column) => {
|
|
310
|
+
(0, MapUtil_js_1.addToDict)(parsedColumns, i, column);
|
|
311
|
+
}, columns);
|
|
312
|
+
return new ArcTableValues(parsedColumns, valueMap, rowCount);
|
|
313
|
+
}
|
|
314
|
+
static init() {
|
|
315
|
+
const valueMap = new Map([]);
|
|
316
|
+
return new ArcTableValues(new Map([]), valueMap, 0);
|
|
317
|
+
}
|
|
318
|
+
ToCellColumns(headers) {
|
|
319
|
+
const this$ = this;
|
|
320
|
+
return (0, Collections_js_1.ResizeArray_init)(headers.length, (i) => {
|
|
321
|
+
const header = headers[i];
|
|
322
|
+
return ColumnValueRefs__ToCellColumn_Z2609C9DD((0, MapUtil_js_1.getItemFromDict)(this$._columns, i), this$._valueMap, this$._rowCount, header);
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
RescanValueMap() {
|
|
326
|
+
const this$ = this;
|
|
327
|
+
const newValueMap = new Map([]);
|
|
328
|
+
let enumerator = (0, Util_js_1.getEnumerator)(this$._columns);
|
|
329
|
+
try {
|
|
330
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
331
|
+
const kv = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
332
|
+
const matchValue = kv[1];
|
|
333
|
+
if (matchValue.tag === /* Sparse */ 1) {
|
|
334
|
+
const values = matchValue.fields[0];
|
|
335
|
+
let enumerator_1 = (0, Util_js_1.getEnumerator)(values);
|
|
336
|
+
try {
|
|
337
|
+
while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
|
|
338
|
+
const ckv = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
339
|
+
const hash_1 = ensureCellHashInValueMap((0, MapUtil_js_1.getItemFromDict)(this$._valueMap, ckv[1]), newValueMap) | 0;
|
|
340
|
+
values.set(ckv[0], hash_1);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
finally {
|
|
344
|
+
(0, Util_js_1.disposeSafe)(enumerator_1);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
const valueHash = matchValue.fields[0] | 0;
|
|
349
|
+
const hash = ensureCellHashInValueMap((0, MapUtil_js_1.getItemFromDict)(this$._valueMap, valueHash), newValueMap) | 0;
|
|
350
|
+
this$._columns.set(kv[0], ColumnValueRefs_Constant(hash));
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
finally {
|
|
355
|
+
(0, Util_js_1.disposeSafe)(enumerator);
|
|
356
|
+
}
|
|
357
|
+
this$._valueMap = newValueMap;
|
|
358
|
+
}
|
|
359
|
+
Copy() {
|
|
360
|
+
const this$ = this;
|
|
361
|
+
const nextValueMap = new Map([]);
|
|
362
|
+
(0, Seq_js_1.iterate)((kv) => {
|
|
363
|
+
(0, MapUtil_js_1.addToDict)(nextValueMap, kv[0], kv[1].Copy());
|
|
364
|
+
}, this$._valueMap);
|
|
365
|
+
const nextColumns = new Map([]);
|
|
366
|
+
(0, Seq_js_1.iterate)((kv_1) => {
|
|
367
|
+
(0, MapUtil_js_1.addToDict)(nextColumns, kv_1[0], ColumnValueRefs__Copy(kv_1[1]));
|
|
368
|
+
}, this$._columns);
|
|
369
|
+
return new ArcTableValues(nextColumns, nextValueMap, this$._rowCount);
|
|
370
|
+
}
|
|
371
|
+
GetHashCode() {
|
|
372
|
+
const this$ = this;
|
|
373
|
+
let hash = 0;
|
|
374
|
+
for (let i = 0; i <= (this$.ColumnCount - 1); i++) {
|
|
375
|
+
let matchValue;
|
|
376
|
+
const dict = this$._columns;
|
|
377
|
+
let patternInput;
|
|
378
|
+
let outArg = (0, Util_js_1.defaultOf)();
|
|
379
|
+
patternInput = [(0, MapUtil_js_1.tryGetValue)(dict, i, new Types_js_1.FSharpRef(() => outArg, (v) => {
|
|
380
|
+
outArg = v;
|
|
381
|
+
})), outArg];
|
|
382
|
+
matchValue = (patternInput[0] ? patternInput[1] : undefined);
|
|
383
|
+
if (matchValue != null) {
|
|
384
|
+
if ((0, Option_js_1.value)(matchValue).tag === /* Sparse */ 1) {
|
|
385
|
+
const values = (0, Option_js_1.value)(matchValue).fields[0];
|
|
386
|
+
let enumerator = (0, Util_js_1.getEnumerator)(values);
|
|
387
|
+
try {
|
|
388
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
389
|
+
const kv = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
390
|
+
hash = ((((-1640531527 + kv[0]) + (hash << 6)) + (hash >> 2)) | 0);
|
|
391
|
+
hash = ((((-1640531527 + kv[1]) + (hash << 6)) + (hash >> 2)) | 0);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
finally {
|
|
395
|
+
(0, Util_js_1.disposeSafe)(enumerator);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
const valueHash = (0, Option_js_1.value)(matchValue).fields[0] | 0;
|
|
400
|
+
for (let i_1 = 0; i_1 <= (this$._rowCount - 1); i_1++) {
|
|
401
|
+
hash = ((((-1640531527 + i_1) + (hash << 6)) + (hash >> 2)) | 0);
|
|
402
|
+
hash = ((((-1640531527 + valueHash) + (hash << 6)) + (hash >> 2)) | 0);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return hash | 0;
|
|
408
|
+
}
|
|
409
|
+
Equals(other) {
|
|
410
|
+
let other_1;
|
|
411
|
+
const this$ = this;
|
|
412
|
+
return (other instanceof ArcTableValues) && ((other_1 = other, (0, Util_js_1.safeHash)(this$) === (0, Util_js_1.safeHash)(other_1)));
|
|
413
|
+
}
|
|
414
|
+
Item(crIndices) {
|
|
415
|
+
const this$ = this;
|
|
416
|
+
const row = crIndices[1] | 0;
|
|
417
|
+
const col = crIndices[0] | 0;
|
|
418
|
+
if (row > (this$.RowCount - 1)) {
|
|
419
|
+
const arg_1 = this$.RowCount | 0;
|
|
420
|
+
(0, String_js_1.toFail)((0, String_js_1.printf)("Row index %d is out of bounds for ArcTableValues with row count %d."))(row)(arg_1);
|
|
421
|
+
}
|
|
422
|
+
if (col > (this$.ColumnCount - 1)) {
|
|
423
|
+
const arg_3 = this$.ColumnCount | 0;
|
|
424
|
+
(0, String_js_1.toFail)((0, String_js_1.printf)("Column index %d is out of bounds for ArcTableValues with column count %d."))(col)(arg_3);
|
|
425
|
+
}
|
|
426
|
+
let matchValue;
|
|
427
|
+
const dict = this$._columns;
|
|
428
|
+
let patternInput;
|
|
429
|
+
let outArg = (0, Util_js_1.defaultOf)();
|
|
430
|
+
patternInput = [(0, MapUtil_js_1.tryGetValue)(dict, col, new Types_js_1.FSharpRef(() => outArg, (v) => {
|
|
431
|
+
outArg = v;
|
|
432
|
+
})), outArg];
|
|
433
|
+
matchValue = (patternInput[0] ? patternInput[1] : undefined);
|
|
434
|
+
if (matchValue != null) {
|
|
435
|
+
const colValueRefs = (0, Option_js_1.value)(matchValue);
|
|
436
|
+
if (colValueRefs.tag === /* Sparse */ 1) {
|
|
437
|
+
const values = colValueRefs.fields[0];
|
|
438
|
+
return values.has(row) ? (0, MapUtil_js_1.getItemFromDict)(this$._valueMap, (0, MapUtil_js_1.getItemFromDict)(values, row)) : (0, String_js_1.toFail)((0, String_js_1.printf)("Row value for index %d does not exist in column %d of ArcTableValues."))(row)(col);
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
const valueHash = colValueRefs.fields[0] | 0;
|
|
442
|
+
return (0, MapUtil_js_1.getItemFromDict)(this$._valueMap, valueHash);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
return (0, String_js_1.toFail)((0, String_js_1.printf)("Column %d does not exist in ArcTableValues."))(col);
|
|
67
447
|
}
|
|
68
448
|
}
|
|
69
|
-
|
|
449
|
+
GetEnumerator() {
|
|
450
|
+
const this$ = this;
|
|
451
|
+
return (0, Util_js_1.getEnumerator)((0, Seq_js_1.delay)(() => (0, Seq_js_1.collect)((colI) => {
|
|
452
|
+
let matchValue;
|
|
453
|
+
const dict = this$._columns;
|
|
454
|
+
let patternInput;
|
|
455
|
+
let outArg = (0, Util_js_1.defaultOf)();
|
|
456
|
+
patternInput = [(0, MapUtil_js_1.tryGetValue)(dict, colI, new Types_js_1.FSharpRef(() => outArg, (v) => {
|
|
457
|
+
outArg = v;
|
|
458
|
+
})), outArg];
|
|
459
|
+
matchValue = (patternInput[0] ? patternInput[1] : undefined);
|
|
460
|
+
if (matchValue != null) {
|
|
461
|
+
const matchValue_1 = (0, Option_js_1.value)(matchValue);
|
|
462
|
+
if (matchValue_1.tag === /* Sparse */ 1) {
|
|
463
|
+
const values = matchValue_1.fields[0];
|
|
464
|
+
return (0, Seq_js_1.collect)((rowI_1) => (values.has(rowI_1) ? (0, Seq_js_1.singleton)([[colI, rowI_1], (0, MapUtil_js_1.getItemFromDict)(this$._valueMap, (0, MapUtil_js_1.getItemFromDict)(values, rowI_1))]) : (0, Seq_js_1.empty)()), (0, Range_js_1.rangeDouble)(0, 1, this$._rowCount - 1));
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
const valueHash = matchValue_1.fields[0] | 0;
|
|
468
|
+
return (0, Seq_js_1.map)((rowI) => [[colI, rowI], (0, MapUtil_js_1.getItemFromDict)(this$._valueMap, valueHash)], (0, Range_js_1.rangeDouble)(0, 1, this$._rowCount - 1));
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
return (0, Seq_js_1.empty)();
|
|
473
|
+
}
|
|
474
|
+
}, (0, Range_js_1.rangeDouble)(0, 1, this$.ColumnCount - 1))));
|
|
475
|
+
}
|
|
476
|
+
[Symbol.iterator]() {
|
|
477
|
+
return (0, Util_js_1.toIterator)((0, Util_js_1.getEnumerator)(this));
|
|
478
|
+
}
|
|
479
|
+
"System.Collections.IEnumerable.GetEnumerator"() {
|
|
480
|
+
const this$ = this;
|
|
481
|
+
return (0, Util_js_1.getEnumerator)(this$);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
exports.ArcTableValues = ArcTableValues;
|
|
485
|
+
function ArcTableValues_$reflection() {
|
|
486
|
+
return (0, Reflection_js_1.class_type)("ARCtrl.ArcTableAux.ArcTableValues", undefined, ArcTableValues);
|
|
487
|
+
}
|
|
488
|
+
function ArcTableValues_$ctor_39436F7C(cols, valueMap, rowCount) {
|
|
489
|
+
return new ArcTableValues(cols, valueMap, rowCount);
|
|
70
490
|
}
|
|
71
491
|
function $007CIsUniqueExistingHeader$007C_$007C(existingHeaders, input) {
|
|
72
492
|
switch (input.tag) {
|
|
@@ -171,63 +591,261 @@ function SanityChecks_validateRowIndex(index, rowCount, allowAppend) {
|
|
|
171
591
|
function SanityChecks_validateColumn(column) {
|
|
172
592
|
column.Validate(true);
|
|
173
593
|
}
|
|
174
|
-
function
|
|
175
|
-
let clo, clo_1;
|
|
594
|
+
function SanityChecks_validateCellColumns(headers, columns, raiseException) {
|
|
595
|
+
let clo, clo_1, clo_2;
|
|
176
596
|
let isValid = true;
|
|
177
|
-
let en = (0, Util_js_1.getEnumerator)(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
597
|
+
let en = (0, Util_js_1.getEnumerator)(headers);
|
|
598
|
+
let colIndex = 0;
|
|
599
|
+
if ((headers.length !== columns.length) && (columns.length !== 0)) {
|
|
600
|
+
(raiseException ? ((message) => {
|
|
601
|
+
throw new Error(message);
|
|
602
|
+
}) : ((clo = (0, String_js_1.toConsole)((0, String_js_1.printf)("%s")), (arg) => {
|
|
603
|
+
clo(arg);
|
|
604
|
+
})))(`Invalid table. Number of headers (${headers.length}) does not match number of columns (${columns.length}).`);
|
|
605
|
+
isValid = false;
|
|
606
|
+
}
|
|
607
|
+
while ((isValid && en["System.Collections.IEnumerator.MoveNext"]()) && (columns.length !== 0)) {
|
|
608
|
+
const header = en["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
609
|
+
let colEn = (0, Util_js_1.getEnumerator)(columns[colIndex]);
|
|
610
|
+
colIndex = ((colIndex + 1) | 0);
|
|
611
|
+
while (isValid && colEn["System.Collections.IEnumerator.MoveNext"]()) {
|
|
612
|
+
const cell = colEn["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
613
|
+
const headerIsData = header.IsDataColumn;
|
|
614
|
+
const headerIsFreetext = !header.IsTermColumn && !header.IsDataColumn;
|
|
615
|
+
const cellIsNotFreetext = !cell.isFreeText;
|
|
616
|
+
if (headerIsData && (!cell.isData && cellIsNotFreetext)) {
|
|
617
|
+
(raiseException ? ((message_1) => {
|
|
618
|
+
throw new Error(message_1);
|
|
619
|
+
}) : ((clo_1 = (0, String_js_1.toConsole)((0, String_js_1.printf)("%s")), (arg_1) => {
|
|
620
|
+
clo_1(arg_1);
|
|
621
|
+
})))(`Invalid combination of header \`${header}\` and cell \`${cell}\`. Data header should contain either Data or Freetext cells.`);
|
|
622
|
+
isValid = false;
|
|
623
|
+
}
|
|
624
|
+
if (headerIsFreetext && cellIsNotFreetext) {
|
|
625
|
+
(raiseException ? ((message_2) => {
|
|
626
|
+
throw new Error(message_2);
|
|
627
|
+
}) : ((clo_2 = (0, String_js_1.toConsole)((0, String_js_1.printf)("%s")), (arg_2) => {
|
|
628
|
+
clo_2(arg_2);
|
|
629
|
+
})))(`Invalid combination of header \`${header}\` and cell \`${cell}\`. Freetext header should not contain non-freetext cells.`);
|
|
630
|
+
isValid = false;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
return isValid;
|
|
635
|
+
}
|
|
636
|
+
function SanityChecks_validateArcTableValues(headers, values, raiseException) {
|
|
637
|
+
let clo;
|
|
638
|
+
let isValid = true;
|
|
639
|
+
let colIndex = 0;
|
|
640
|
+
if ((headers.length !== values.ColumnCount) && (values.ColumnCount !== 0)) {
|
|
641
|
+
(raiseException ? ((message) => {
|
|
642
|
+
throw new Error(message);
|
|
643
|
+
}) : ((clo = (0, String_js_1.toConsole)((0, String_js_1.printf)("%s")), (arg) => {
|
|
644
|
+
clo(arg);
|
|
645
|
+
})))(`Invalid table. Number of headers (${headers.length}) does not match number of columns (${values.ColumnCount}).`);
|
|
646
|
+
isValid = false;
|
|
647
|
+
}
|
|
648
|
+
if ((values.RowCount !== 0) && (values.ColumnCount !== 0)) {
|
|
649
|
+
while (isValid && (colIndex < values.ColumnCount)) {
|
|
650
|
+
const header = headers[colIndex];
|
|
651
|
+
let matchValue;
|
|
652
|
+
const key = colIndex | 0;
|
|
653
|
+
const dict = values.Columns;
|
|
654
|
+
let patternInput;
|
|
655
|
+
let outArg = (0, Util_js_1.defaultOf)();
|
|
656
|
+
patternInput = [(0, MapUtil_js_1.tryGetValue)(dict, key, new Types_js_1.FSharpRef(() => outArg, (v) => {
|
|
657
|
+
outArg = v;
|
|
658
|
+
})), outArg];
|
|
659
|
+
matchValue = (patternInput[0] ? patternInput[1] : undefined);
|
|
660
|
+
if (matchValue != null) {
|
|
661
|
+
if ((0, Option_js_1.value)(matchValue).tag === /* Sparse */ 1) {
|
|
662
|
+
const column = (0, Option_js_1.value)(matchValue).fields[0];
|
|
663
|
+
let enumerator = (0, Util_js_1.getEnumerator)(column);
|
|
664
|
+
try {
|
|
665
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
666
|
+
const kv = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
667
|
+
const cell_1 = (0, MapUtil_js_1.getItemFromDict)(values.ValueMap, kv[1]);
|
|
668
|
+
if (!cell_1.ValidateAgainstHeader(header, raiseException)) {
|
|
669
|
+
isValid = false;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
finally {
|
|
674
|
+
(0, Util_js_1.disposeSafe)(enumerator);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
else {
|
|
678
|
+
const hash = (0, Option_js_1.value)(matchValue).fields[0] | 0;
|
|
679
|
+
const cell = (0, MapUtil_js_1.getItemFromDict)(values.ValueMap, hash);
|
|
680
|
+
if (!cell.ValidateAgainstHeader(header, raiseException)) {
|
|
681
|
+
isValid = false;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
colIndex = ((colIndex + 1) | 0);
|
|
204
686
|
}
|
|
205
687
|
}
|
|
206
688
|
return isValid;
|
|
207
689
|
}
|
|
208
|
-
function Unchecked_tryGetCellAt(column, row,
|
|
209
|
-
|
|
690
|
+
function Unchecked_tryGetCellAt(column, row, values) {
|
|
691
|
+
let dict, patternInput, outArg;
|
|
692
|
+
return (0, Option_js_1.bind)((col) => {
|
|
693
|
+
if (col.tag === /* Sparse */ 1) {
|
|
694
|
+
const vals = col.fields[0];
|
|
695
|
+
if (vals.has(row)) {
|
|
696
|
+
return (0, MapUtil_js_1.getItemFromDict)(values.ValueMap, (0, MapUtil_js_1.getItemFromDict)(vals, row));
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
return undefined;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
else {
|
|
703
|
+
const valueHash = col.fields[0] | 0;
|
|
704
|
+
return (0, MapUtil_js_1.getItemFromDict)(values.ValueMap, valueHash);
|
|
705
|
+
}
|
|
706
|
+
}, (dict = values.Columns, (patternInput = ((outArg = (0, Util_js_1.defaultOf)(), [(0, MapUtil_js_1.tryGetValue)(dict, column, new Types_js_1.FSharpRef(() => outArg, (v) => {
|
|
707
|
+
outArg = v;
|
|
708
|
+
})), outArg])), patternInput[0] ? patternInput[1] : undefined)));
|
|
709
|
+
}
|
|
710
|
+
function Unchecked_getCellWithDefault(column, row, headers, values) {
|
|
711
|
+
if (headers.length <= column) {
|
|
712
|
+
const arg_1 = headers.length | 0;
|
|
713
|
+
(0, String_js_1.toFail)((0, String_js_1.printf)("Column index %d is out of bounds for ArcTableValues with column count %d."))(column)(arg_1);
|
|
714
|
+
}
|
|
715
|
+
let matchValue;
|
|
716
|
+
const dict = values.Columns;
|
|
717
|
+
let patternInput;
|
|
718
|
+
let outArg = (0, Util_js_1.defaultOf)();
|
|
719
|
+
patternInput = [(0, MapUtil_js_1.tryGetValue)(dict, column, new Types_js_1.FSharpRef(() => outArg, (v) => {
|
|
720
|
+
outArg = v;
|
|
721
|
+
})), outArg];
|
|
722
|
+
matchValue = (patternInput[0] ? patternInput[1] : undefined);
|
|
723
|
+
if (matchValue == null) {
|
|
724
|
+
if (row < values.RowCount) {
|
|
725
|
+
return CompositeCell_js_1.CompositeCell.emptyFreeText;
|
|
726
|
+
}
|
|
727
|
+
else {
|
|
728
|
+
return getEmptyCellForHeader(headers[column], undefined);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
else {
|
|
732
|
+
const col = (0, Option_js_1.value)(matchValue);
|
|
733
|
+
if (col.tag === /* Sparse */ 1) {
|
|
734
|
+
const vals = col.fields[0];
|
|
735
|
+
if (vals.has(row)) {
|
|
736
|
+
return (0, MapUtil_js_1.getItemFromDict)(values.ValueMap, (0, MapUtil_js_1.getItemFromDict)(vals, row));
|
|
737
|
+
}
|
|
738
|
+
else if (vals.size === 0) {
|
|
739
|
+
return getEmptyCellForHeader(headers[column], undefined);
|
|
740
|
+
}
|
|
741
|
+
else {
|
|
742
|
+
const header_1 = headers[column];
|
|
743
|
+
const maxI = (0, Seq_js_1.max)(vals.keys(), {
|
|
744
|
+
Compare: Util_js_1.comparePrimitives,
|
|
745
|
+
}) | 0;
|
|
746
|
+
return getEmptyCellForHeader(header_1, (0, MapUtil_js_1.getItemFromDict)(values.ValueMap, (0, MapUtil_js_1.getItemFromDict)(vals, maxI)));
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
else {
|
|
750
|
+
const valueHash = col.fields[0] | 0;
|
|
751
|
+
return (0, MapUtil_js_1.getItemFromDict)(values.ValueMap, valueHash);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
210
754
|
}
|
|
211
755
|
/**
|
|
212
756
|
* Add or update a cell in the dictionary.
|
|
213
757
|
*/
|
|
214
|
-
function Unchecked_setCellAt(columnIndex, rowIndex, c,
|
|
215
|
-
|
|
758
|
+
function Unchecked_setCellAt(columnIndex, rowIndex, c, values) {
|
|
759
|
+
if ((rowIndex + 1) > values.RowCount) {
|
|
760
|
+
values.RowCount = ((rowIndex + 1) | 0);
|
|
761
|
+
}
|
|
762
|
+
let matchValue;
|
|
763
|
+
const dict = values.Columns;
|
|
764
|
+
let patternInput;
|
|
765
|
+
let outArg = (0, Util_js_1.defaultOf)();
|
|
766
|
+
patternInput = [(0, MapUtil_js_1.tryGetValue)(dict, columnIndex, new Types_js_1.FSharpRef(() => outArg, (v) => {
|
|
767
|
+
outArg = v;
|
|
768
|
+
})), outArg];
|
|
769
|
+
matchValue = (patternInput[0] ? patternInput[1] : undefined);
|
|
770
|
+
if (matchValue != null) {
|
|
771
|
+
const col = (0, Option_js_1.value)(matchValue);
|
|
772
|
+
if (col.tag === /* Sparse */ 1) {
|
|
773
|
+
const vals = col.fields[0];
|
|
774
|
+
const key_1 = rowIndex | 0;
|
|
775
|
+
const value = ensureCellHashInValueMap(c, values.ValueMap) | 0;
|
|
776
|
+
const dict_1 = vals;
|
|
777
|
+
if (dict_1.has(key_1)) {
|
|
778
|
+
dict_1.set(key_1, value);
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
(0, MapUtil_js_1.addToDict)(dict_1, key_1, value);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
else {
|
|
785
|
+
const valueHash = col.fields[0] | 0;
|
|
786
|
+
const hash_2 = ensureCellHashInValueMap(c, values.ValueMap) | 0;
|
|
787
|
+
if (hash_2 === valueHash) {
|
|
788
|
+
}
|
|
789
|
+
else {
|
|
790
|
+
const d = new Map([]);
|
|
791
|
+
for (let i = 0; i <= (values.RowCount - 1); i++) {
|
|
792
|
+
if (i === rowIndex) {
|
|
793
|
+
(0, MapUtil_js_1.addToDict)(d, i, hash_2);
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
(0, MapUtil_js_1.addToDict)(d, i, valueHash);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
values.Columns.set(columnIndex, ColumnValueRefs_Sparse(d));
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
else if ((values.RowCount <= 1) && (rowIndex === 0)) {
|
|
804
|
+
const hash = ensureCellHashInValueMap(c, values.ValueMap) | 0;
|
|
805
|
+
(0, MapUtil_js_1.addToDict)(values.Columns, columnIndex, ColumnValueRefs_Constant(hash));
|
|
806
|
+
}
|
|
807
|
+
else {
|
|
808
|
+
const newColumn = new Map([]);
|
|
809
|
+
(0, MapUtil_js_1.addToDict)(newColumn, rowIndex, ensureCellHashInValueMap(c, values.ValueMap));
|
|
810
|
+
(0, MapUtil_js_1.addToDict)(values.Columns, columnIndex, ColumnValueRefs_Sparse(newColumn));
|
|
811
|
+
}
|
|
216
812
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
(0,
|
|
813
|
+
function Unchecked_removeCellAt(columnIndex, rowIndex, values) {
|
|
814
|
+
let matchValue;
|
|
815
|
+
const dict = values.Columns;
|
|
816
|
+
let patternInput;
|
|
817
|
+
let outArg = (0, Util_js_1.defaultOf)();
|
|
818
|
+
patternInput = [(0, MapUtil_js_1.tryGetValue)(dict, columnIndex, new Types_js_1.FSharpRef(() => outArg, (v) => {
|
|
819
|
+
outArg = v;
|
|
820
|
+
})), outArg];
|
|
821
|
+
matchValue = (patternInput[0] ? patternInput[1] : undefined);
|
|
822
|
+
if (matchValue != null) {
|
|
823
|
+
const col = (0, Option_js_1.value)(matchValue);
|
|
824
|
+
if (col.tag === /* Sparse */ 1) {
|
|
825
|
+
const vals = col.fields[0];
|
|
826
|
+
if (vals.has(rowIndex)) {
|
|
827
|
+
vals.delete(rowIndex);
|
|
828
|
+
if (vals.size === 0) {
|
|
829
|
+
values.Columns.delete(columnIndex);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
else {
|
|
834
|
+
const valueHash = col.fields[0] | 0;
|
|
835
|
+
if ((rowIndex === 0) && (values.RowCount === 1)) {
|
|
836
|
+
values.Columns.delete(columnIndex);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
222
840
|
}
|
|
223
|
-
function Unchecked_moveCellTo(fromCol, fromRow, toCol, toRow,
|
|
224
|
-
const matchValue = (
|
|
841
|
+
function Unchecked_moveCellTo(fromCol, fromRow, toCol, toRow, values) {
|
|
842
|
+
const matchValue = Unchecked_tryGetCellAt(fromCol, fromRow, values);
|
|
225
843
|
if (matchValue == null) {
|
|
226
844
|
}
|
|
227
845
|
else {
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
846
|
+
const cell = (0, Option_js_1.value)(matchValue);
|
|
847
|
+
Unchecked_removeCellAt(fromCol, fromRow, values);
|
|
848
|
+
Unchecked_setCellAt(toCol, toRow, cell, values);
|
|
231
849
|
}
|
|
232
850
|
}
|
|
233
851
|
function Unchecked_removeHeader(index, headers) {
|
|
@@ -236,121 +854,161 @@ function Unchecked_removeHeader(index, headers) {
|
|
|
236
854
|
/**
|
|
237
855
|
* Remove cells of one Column, change index of cells with higher index to index - 1
|
|
238
856
|
*/
|
|
239
|
-
function Unchecked_removeColumnCells(
|
|
240
|
-
|
|
241
|
-
try {
|
|
242
|
-
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
243
|
-
const activePatternResult = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
244
|
-
const c = activePatternResult[0][0] | 0;
|
|
245
|
-
if (c === index) {
|
|
246
|
-
cells.delete([c, activePatternResult[0][1]]);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
finally {
|
|
251
|
-
(0, Util_js_1.disposeSafe)(enumerator);
|
|
252
|
-
}
|
|
857
|
+
function Unchecked_removeColumnCells(colIndex, values) {
|
|
858
|
+
values.Columns.delete(colIndex);
|
|
253
859
|
}
|
|
254
860
|
/**
|
|
255
861
|
* Remove cells of one Column, change index of cells with higher index to index - 1
|
|
256
862
|
*/
|
|
257
|
-
function Unchecked_removeColumnCells_withIndexChange(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
863
|
+
function Unchecked_removeColumnCells_withIndexChange(colIndex, columnCount, values) {
|
|
864
|
+
if (colIndex < (columnCount - 1)) {
|
|
865
|
+
const cols = new Map([]);
|
|
866
|
+
(0, Seq_js_1.iterate)((kv) => {
|
|
867
|
+
const cI = kv[0] | 0;
|
|
868
|
+
if (cI > colIndex) {
|
|
869
|
+
(0, MapUtil_js_1.addToDict)(cols, cI - 1, kv[1]);
|
|
262
870
|
}
|
|
263
|
-
else if (
|
|
264
|
-
|
|
871
|
+
else if (cI < colIndex) {
|
|
872
|
+
(0, MapUtil_js_1.addToDict)(cols, cI, kv[1]);
|
|
265
873
|
}
|
|
266
|
-
}
|
|
874
|
+
}, values.Columns);
|
|
875
|
+
values.Columns = cols;
|
|
267
876
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
let enumerator = (0, Util_js_1.getEnumerator)(cells);
|
|
271
|
-
try {
|
|
272
|
-
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
273
|
-
const activePatternResult = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
274
|
-
const r = activePatternResult[0][1] | 0;
|
|
275
|
-
if (r === rowIndex) {
|
|
276
|
-
cells.delete([activePatternResult[0][0], r]);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
877
|
+
else {
|
|
878
|
+
const value = Unchecked_removeColumnCells(colIndex, values);
|
|
279
879
|
}
|
|
280
|
-
|
|
281
|
-
|
|
880
|
+
}
|
|
881
|
+
function Unchecked_removeRowCells(rowIndex, columnCount, values) {
|
|
882
|
+
for (let c = 0; c <= (columnCount - 1); c++) {
|
|
883
|
+
Unchecked_removeCellAt(c, rowIndex, values);
|
|
282
884
|
}
|
|
283
885
|
}
|
|
284
886
|
/**
|
|
285
887
|
* Remove cells of one Row, change index of cells with higher index to index - 1
|
|
286
888
|
*/
|
|
287
|
-
function Unchecked_removeRowCells_withIndexChange(rowIndex,
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
889
|
+
function Unchecked_removeRowCells_withIndexChange(rowIndex, values) {
|
|
890
|
+
if ((rowIndex === 0) && (values.RowCount === 1)) {
|
|
891
|
+
values.RowCount = 0;
|
|
892
|
+
values.Columns = (new Map([]));
|
|
893
|
+
}
|
|
894
|
+
else {
|
|
895
|
+
(0, Seq_js_1.iterate)((kv) => {
|
|
896
|
+
const matchValue = kv[1];
|
|
897
|
+
if (matchValue.tag === /* Sparse */ 1) {
|
|
898
|
+
const vals = matchValue.fields[0];
|
|
899
|
+
if (rowIndex < (values.RowCount - 1)) {
|
|
900
|
+
const col = new Map([]);
|
|
901
|
+
(0, Seq_js_1.iterate)((kv_1) => {
|
|
902
|
+
const rI = kv_1[0] | 0;
|
|
903
|
+
if (rI > rowIndex) {
|
|
904
|
+
(0, MapUtil_js_1.addToDict)(col, rI - 1, kv_1[1]);
|
|
905
|
+
}
|
|
906
|
+
else if (rI < rowIndex) {
|
|
907
|
+
(0, MapUtil_js_1.addToDict)(col, rI, kv_1[1]);
|
|
908
|
+
}
|
|
909
|
+
}, vals);
|
|
910
|
+
values.Columns.set(kv[0], ColumnValueRefs_Sparse(col));
|
|
911
|
+
}
|
|
912
|
+
else {
|
|
913
|
+
vals.delete(rowIndex);
|
|
914
|
+
}
|
|
295
915
|
}
|
|
296
|
-
}
|
|
916
|
+
}, values.Columns);
|
|
917
|
+
values.RowCount = ((values.RowCount - 1) | 0);
|
|
297
918
|
}
|
|
298
919
|
}
|
|
299
920
|
/**
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
* `columCellOption` is used to decide between `CompositeCell.Term` or `CompositeCell.Unitized`. `columCellOption` can be any other cell in the same column, preferably the first one.
|
|
921
|
+
* Remove cells of one Row, change index of cells with higher index to index - 1
|
|
303
922
|
*/
|
|
304
|
-
function
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
923
|
+
function Unchecked_removeRowRange_withIndexChange(rowStartIndex, rowEndIndex, values) {
|
|
924
|
+
if ((rowStartIndex === 0) && (values.RowCount === rowEndIndex)) {
|
|
925
|
+
values.RowCount = 0;
|
|
926
|
+
values.Columns = (new Map([]));
|
|
927
|
+
}
|
|
928
|
+
else {
|
|
929
|
+
(0, Seq_js_1.iterate)((kv) => {
|
|
930
|
+
const matchValue = kv[1];
|
|
931
|
+
if (matchValue.tag === /* Sparse */ 1) {
|
|
932
|
+
const vals = matchValue.fields[0];
|
|
933
|
+
const range = ((rowEndIndex - rowStartIndex) + 1) | 0;
|
|
934
|
+
if (rowEndIndex < (values.RowCount - 1)) {
|
|
935
|
+
const col = new Map([]);
|
|
936
|
+
(0, Seq_js_1.iterate)((kv_1) => {
|
|
937
|
+
const rI = kv_1[0] | 0;
|
|
938
|
+
if (rI > rowEndIndex) {
|
|
939
|
+
(0, MapUtil_js_1.addToDict)(col, rI - range, kv_1[1]);
|
|
940
|
+
}
|
|
941
|
+
else if (rI < rowStartIndex) {
|
|
942
|
+
(0, MapUtil_js_1.addToDict)(col, rI, kv_1[1]);
|
|
943
|
+
}
|
|
944
|
+
}, vals);
|
|
945
|
+
values.Columns.set(kv[0], ColumnValueRefs_Sparse(col));
|
|
316
946
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
947
|
+
else {
|
|
948
|
+
for (let rowIndex = rowStartIndex; rowIndex <= rowEndIndex; rowIndex++) {
|
|
949
|
+
vals.delete(rowIndex);
|
|
950
|
+
}
|
|
320
951
|
}
|
|
321
|
-
default:
|
|
322
|
-
matchResult = 2;
|
|
323
952
|
}
|
|
953
|
+
}, values.Columns);
|
|
954
|
+
values.RowCount = ((values.RowCount - ((rowEndIndex - rowStartIndex) + 1)) | 0);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
function Unchecked_moveColumnCellsTo(fromCol, toCol, values) {
|
|
958
|
+
let matchValue;
|
|
959
|
+
const dict = values.Columns;
|
|
960
|
+
let patternInput;
|
|
961
|
+
let outArg = (0, Util_js_1.defaultOf)();
|
|
962
|
+
patternInput = [(0, MapUtil_js_1.tryGetValue)(dict, fromCol, new Types_js_1.FSharpRef(() => outArg, (v) => {
|
|
963
|
+
outArg = v;
|
|
964
|
+
})), outArg];
|
|
965
|
+
matchValue = (patternInput[0] ? patternInput[1] : undefined);
|
|
966
|
+
if (matchValue != null) {
|
|
967
|
+
const col = (0, Option_js_1.value)(matchValue);
|
|
968
|
+
Unchecked_removeColumnCells(fromCol, values);
|
|
969
|
+
const key_1 = toCol | 0;
|
|
970
|
+
const value = col;
|
|
971
|
+
const dict_1 = values.Columns;
|
|
972
|
+
if (dict_1.has(key_1)) {
|
|
973
|
+
dict_1.set(key_1, value);
|
|
324
974
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
return CompositeCell_js_1.CompositeCell.emptyTerm;
|
|
328
|
-
case 1:
|
|
329
|
-
return CompositeCell_js_1.CompositeCell.emptyUnitized;
|
|
330
|
-
default:
|
|
331
|
-
throw new Error("[extendBodyCells] This should never happen, IsTermColumn header must be paired with either term or unitized cell.");
|
|
975
|
+
else {
|
|
976
|
+
(0, MapUtil_js_1.addToDict)(dict_1, key_1, value);
|
|
332
977
|
}
|
|
333
978
|
}
|
|
334
|
-
else {
|
|
335
|
-
return CompositeCell_js_1.CompositeCell.emptyFreeText;
|
|
336
|
-
}
|
|
337
979
|
}
|
|
338
980
|
/**
|
|
339
|
-
*
|
|
981
|
+
* Add a new column to the ArcTableValues.
|
|
340
982
|
*/
|
|
341
|
-
function
|
|
983
|
+
function Unchecked_addRefColumn(newHeader, newCol, rowCount, index, forceReplace, onlyHeaders, headers, values) {
|
|
342
984
|
let numberOfNewColumns = 1;
|
|
343
985
|
let index_1 = index;
|
|
344
986
|
const hasDuplicateUnique = tryFindDuplicateUnique(newHeader, headers);
|
|
345
987
|
if (!forceReplace && (hasDuplicateUnique != null)) {
|
|
346
988
|
throw new Error(`Invalid new column \`${newHeader}\`. Table already contains header of the same type on index \`${(0, Option_js_1.value)(hasDuplicateUnique)}\``);
|
|
347
989
|
}
|
|
990
|
+
if (rowCount > values.RowCount) {
|
|
991
|
+
values.RowCount = (rowCount | 0);
|
|
992
|
+
let enumerator = (0, Util_js_1.getEnumerator)(values.Columns);
|
|
993
|
+
try {
|
|
994
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
995
|
+
const kv = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
996
|
+
values.Columns.set(kv[0], ColumnValueRefs__ToSparse_Z524259A4(kv[1], values.RowCount));
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
finally {
|
|
1000
|
+
(0, Util_js_1.disposeSafe)(enumerator);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
if ((((rowCount < values.RowCount) && (hasDuplicateUnique != null)) && forceReplace) && (values.Columns.size === 1)) {
|
|
1004
|
+
values.RowCount = (rowCount | 0);
|
|
1005
|
+
}
|
|
348
1006
|
if (hasDuplicateUnique != null) {
|
|
349
1007
|
numberOfNewColumns = 0;
|
|
350
1008
|
index_1 = ((0, Option_js_1.value)(hasDuplicateUnique) | 0);
|
|
351
1009
|
}
|
|
352
|
-
const matchValue =
|
|
353
|
-
const matchValue_1 =
|
|
1010
|
+
const matchValue = headers.length | 0;
|
|
1011
|
+
const matchValue_1 = values.RowCount | 0;
|
|
354
1012
|
const startColCount = matchValue | 0;
|
|
355
1013
|
if (hasDuplicateUnique != null) {
|
|
356
1014
|
Unchecked_removeHeader(index_1, headers);
|
|
@@ -359,77 +1017,97 @@ function Unchecked_addColumn(newHeader, newCells, index, forceReplace, onlyHeade
|
|
|
359
1017
|
if ((index_1 < startColCount) && (hasDuplicateUnique == null)) {
|
|
360
1018
|
const lastColumnIndex = (0, Double_js_1.max)(startColCount - 1, 0) | 0;
|
|
361
1019
|
for (let columnIndex = lastColumnIndex; columnIndex >= index_1; columnIndex--) {
|
|
362
|
-
|
|
363
|
-
Unchecked_moveCellTo(columnIndex, rowIndex, columnIndex + numberOfNewColumns, rowIndex, values);
|
|
364
|
-
}
|
|
1020
|
+
Unchecked_moveColumnCellsTo(columnIndex, columnIndex + numberOfNewColumns, values);
|
|
365
1021
|
}
|
|
366
1022
|
}
|
|
367
1023
|
if (!onlyHeaders) {
|
|
368
|
-
|
|
369
|
-
|
|
1024
|
+
const key = index_1 | 0;
|
|
1025
|
+
const value = newCol;
|
|
1026
|
+
const dict = values.Columns;
|
|
1027
|
+
if (dict.has(key)) {
|
|
1028
|
+
dict.set(key, value);
|
|
1029
|
+
}
|
|
1030
|
+
else {
|
|
1031
|
+
(0, MapUtil_js_1.addToDict)(dict, key, value);
|
|
370
1032
|
}
|
|
371
|
-
const f = (index_1 >= startColCount) ? ((tupledArg) => ((values_1) => {
|
|
372
|
-
const value = (0, MapUtil_js_1.addToDict)(values_1, [tupledArg[0], tupledArg[1]], tupledArg[2]);
|
|
373
|
-
})) : ((tupledArg_1) => ((cells) => {
|
|
374
|
-
Unchecked_setCellAt(tupledArg_1[0], tupledArg_1[1], tupledArg_1[2], cells);
|
|
375
|
-
}));
|
|
376
|
-
(0, Array_js_1.iterateIndexed)((rowIndex_3, cell_1) => {
|
|
377
|
-
f([index_1, rowIndex_3, cell_1])(values);
|
|
378
|
-
}, newCells);
|
|
379
1033
|
}
|
|
380
1034
|
}
|
|
1035
|
+
function Unchecked_addColumn(newHeader, newCells, index, forceReplace, onlyHeaders, headers, values) {
|
|
1036
|
+
Unchecked_addRefColumn(newHeader, ColumnValueRefs_fromCellColumn_14896151(newCells, values.RowCount, values.ValueMap), (0, Seq_js_1.length)(newCells), index, forceReplace, onlyHeaders, headers, values);
|
|
1037
|
+
}
|
|
1038
|
+
function Unchecked_addColumnFill(newHeader, newCell, index, forceReplace, onlyHeaders, headers, values) {
|
|
1039
|
+
Unchecked_addRefColumn(newHeader, ColumnValueRefs_Constant(ensureCellHashInValueMap(newCell, values.ValueMap)), 1, index, forceReplace, onlyHeaders, headers, values);
|
|
1040
|
+
}
|
|
381
1041
|
function Unchecked_fillMissingCells(headers, values) {
|
|
382
|
-
let
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
for (let rowIndex = 0; rowIndex <= (rowCount - 1); rowIndex++) {
|
|
410
|
-
if (!(0, Set_js_1.FSharpSet__Contains)(rowKeys, rowIndex)) {
|
|
411
|
-
Unchecked_addCellAt(columnIndex, rowIndex, defaultCell.Copy(), values);
|
|
1042
|
+
let i_1;
|
|
1043
|
+
if (values.RowCount === 0) {
|
|
1044
|
+
}
|
|
1045
|
+
else {
|
|
1046
|
+
for (let i = 0; i <= (values.ColumnCount - 1); i++) {
|
|
1047
|
+
let matchValue;
|
|
1048
|
+
const dict = values.Columns;
|
|
1049
|
+
let patternInput;
|
|
1050
|
+
let outArg = (0, Util_js_1.defaultOf)();
|
|
1051
|
+
patternInput = [(0, MapUtil_js_1.tryGetValue)(dict, i, new Types_js_1.FSharpRef(() => outArg, (v) => {
|
|
1052
|
+
outArg = v;
|
|
1053
|
+
})), outArg];
|
|
1054
|
+
matchValue = (patternInput[0] ? patternInput[1] : undefined);
|
|
1055
|
+
if (matchValue != null) {
|
|
1056
|
+
if ((0, Option_js_1.value)(matchValue).tag === /* Sparse */ 1) {
|
|
1057
|
+
const vals = (0, Option_js_1.value)(matchValue).fields[0];
|
|
1058
|
+
if (vals.size < values.RowCount) {
|
|
1059
|
+
const header = headers[i];
|
|
1060
|
+
const defaultHash = ensureCellHashInValueMap((vals.size === 0) ? getEmptyCellForHeader(header, undefined) : ((i_1 = ((0, Seq_js_1.max)(vals.keys(), {
|
|
1061
|
+
Compare: Util_js_1.comparePrimitives,
|
|
1062
|
+
}) | 0), getEmptyCellForHeader(header, (0, MapUtil_js_1.getItemFromDict)(values.ValueMap, (0, MapUtil_js_1.getItemFromDict)(vals, i_1))))), values.ValueMap) | 0;
|
|
1063
|
+
for (let j = vals.size; j <= (values.RowCount - 1); j++) {
|
|
1064
|
+
if (!vals.has(j)) {
|
|
1065
|
+
(0, MapUtil_js_1.addToDict)(vals, j, defaultHash);
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
412
1069
|
}
|
|
413
1070
|
}
|
|
1071
|
+
else {
|
|
1072
|
+
const col = ColumnValueRefs_Constant(ensureCellHashInValueMap(getEmptyCellForHeader(headers[i], undefined), values.ValueMap));
|
|
1073
|
+
const value = (0, MapUtil_js_1.addToDict)(values.Columns, i, col);
|
|
1074
|
+
}
|
|
414
1075
|
}
|
|
415
1076
|
}
|
|
416
1077
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
1078
|
+
function Unchecked_addEmptyRow(index, values) {
|
|
1079
|
+
if ((index < values.RowCount) && (values.ColumnCount !== 0)) {
|
|
1080
|
+
let enumerator = (0, Util_js_1.getEnumerator)(values.Columns);
|
|
1081
|
+
try {
|
|
1082
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1083
|
+
const matchValue = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]()[1];
|
|
1084
|
+
if (matchValue.tag === /* Sparse */ 1) {
|
|
1085
|
+
const dict = matchValue.fields[0];
|
|
1086
|
+
const maxIndex = (0, Seq_js_1.max)(dict.keys(), {
|
|
1087
|
+
Compare: Util_js_1.comparePrimitives,
|
|
1088
|
+
}) | 0;
|
|
1089
|
+
for (let i = maxIndex; i >= ((index + 1) - 1); i--) {
|
|
1090
|
+
if (dict.has(i)) {
|
|
1091
|
+
const v = (0, MapUtil_js_1.getItemFromDict)(dict, i) | 0;
|
|
1092
|
+
dict.delete(i);
|
|
1093
|
+
(0, MapUtil_js_1.addToDict)(dict, i + 1, v);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
else {
|
|
1098
|
+
const valueHash = matchValue.fields[0] | 0;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
finally {
|
|
1103
|
+
(0, Util_js_1.disposeSafe)(enumerator);
|
|
427
1104
|
}
|
|
428
1105
|
}
|
|
1106
|
+
values.RowCount = ((values.RowCount + 1) | 0);
|
|
429
1107
|
}
|
|
430
1108
|
function Unchecked_addRow(index, newCells, headers, values) {
|
|
431
|
-
const rowCount =
|
|
432
|
-
const columnCount =
|
|
1109
|
+
const rowCount = values.RowCount | 0;
|
|
1110
|
+
const columnCount = values.ColumnCount | 0;
|
|
433
1111
|
let increaseRowIndices;
|
|
434
1112
|
if (index < rowCount) {
|
|
435
1113
|
const lastRowIndex = (0, Double_js_1.max)(rowCount - 1, 0) | 0;
|
|
@@ -442,13 +1120,13 @@ function Unchecked_addRow(index, newCells, headers, values) {
|
|
|
442
1120
|
else {
|
|
443
1121
|
increaseRowIndices = undefined;
|
|
444
1122
|
}
|
|
445
|
-
const setNewCells = (0,
|
|
1123
|
+
const setNewCells = (0, Collections_js_1.ResizeArray_iteri)((columnIndex_1, cell) => {
|
|
446
1124
|
Unchecked_setCellAt(columnIndex_1, index, cell, values);
|
|
447
1125
|
}, newCells);
|
|
448
1126
|
}
|
|
449
1127
|
function Unchecked_addRows(index, newRows, headers, values) {
|
|
450
|
-
const rowCount =
|
|
451
|
-
const columnCount =
|
|
1128
|
+
const rowCount = values.RowCount | 0;
|
|
1129
|
+
const columnCount = values.ColumnCount | 0;
|
|
452
1130
|
const numNewRows = newRows.length | 0;
|
|
453
1131
|
let increaseRowIndices;
|
|
454
1132
|
if (index < rowCount) {
|
|
@@ -463,11 +1141,17 @@ function Unchecked_addRows(index, newRows, headers, values) {
|
|
|
463
1141
|
increaseRowIndices = undefined;
|
|
464
1142
|
}
|
|
465
1143
|
let currentRowIndex = index;
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
1144
|
+
let enumerator = (0, Util_js_1.getEnumerator)(newRows);
|
|
1145
|
+
try {
|
|
1146
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1147
|
+
const setNewCells = (0, Collections_js_1.ResizeArray_iteri)((columnIndex_1, cell) => {
|
|
1148
|
+
Unchecked_setCellAt(columnIndex_1, currentRowIndex, cell, values);
|
|
1149
|
+
}, enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]());
|
|
1150
|
+
currentRowIndex = ((currentRowIndex + 1) | 0);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
finally {
|
|
1154
|
+
(0, Util_js_1.disposeSafe)(enumerator);
|
|
471
1155
|
}
|
|
472
1156
|
}
|
|
473
1157
|
/**
|
|
@@ -481,7 +1165,7 @@ function Unchecked_compositeHeaderMainColumnEqual(ch1, ch2) {
|
|
|
481
1165
|
*
|
|
482
1166
|
* This function moves the column from `fromCol` to `toCol` and shifts all columns in between accordingly
|
|
483
1167
|
*/
|
|
484
|
-
function Unchecked_moveColumnTo(
|
|
1168
|
+
function Unchecked_moveColumnTo(fromCol, toCol, headers, values) {
|
|
485
1169
|
const patternInput = (fromCol < toCol) ? [-1, fromCol + 1, toCol] : [1, fromCol - 1, toCol];
|
|
486
1170
|
const shiftStart = patternInput[1] | 0;
|
|
487
1171
|
const shiftEnd = patternInput[2] | 0;
|
|
@@ -498,20 +1182,18 @@ function Unchecked_moveColumnTo(rowCount, fromCol, toCol, headers, values) {
|
|
|
498
1182
|
(0, Util_js_1.disposeSafe)(enumerator);
|
|
499
1183
|
}
|
|
500
1184
|
(0, Array_js_1.setItem)(headers, toCol, header);
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
values.set([c_1 + shift, r], (0, MapUtil_js_1.getItemFromDict)(values, [c_1, r]));
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
finally {
|
|
511
|
-
(0, Util_js_1.disposeSafe)(enumerator_1);
|
|
1185
|
+
const col = (0, MapUtil_js_1.getItemFromDict)(values.Columns, fromCol);
|
|
1186
|
+
const enumerator_1 = (0, Util_js_1.getEnumerator)((0, Seq_js_1.toList)((0, Range_js_1.rangeDouble)(shiftStart, (0, Int32_js_1.op_UnaryNegation_Int32)(shift), shiftEnd)));
|
|
1187
|
+
try {
|
|
1188
|
+
while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1189
|
+
const c_1 = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]() | 0;
|
|
1190
|
+
values.Columns.set(c_1 + shift, (0, MapUtil_js_1.getItemFromDict)(values.Columns, c_1));
|
|
512
1191
|
}
|
|
513
|
-
values.set([toCol, r], cell);
|
|
514
1192
|
}
|
|
1193
|
+
finally {
|
|
1194
|
+
(0, Util_js_1.disposeSafe)(enumerator_1);
|
|
1195
|
+
}
|
|
1196
|
+
values.Columns.set(toCol, col);
|
|
515
1197
|
}
|
|
516
1198
|
/**
|
|
517
1199
|
* From a list of rows consisting of headers and values, creates a list of combined headers and the values as a sparse matrix
|
|
@@ -524,10 +1206,8 @@ function Unchecked_moveColumnTo(rowCount, fromCol, toCol, headers, values) {
|
|
|
524
1206
|
*/
|
|
525
1207
|
function Unchecked_alignByHeaders(keepOrder, rows) {
|
|
526
1208
|
const headers = [];
|
|
527
|
-
const values =
|
|
528
|
-
|
|
529
|
-
GetHashCode: Util_js_1.arrayHash,
|
|
530
|
-
});
|
|
1209
|
+
const values = ArcTableValues.init();
|
|
1210
|
+
values.RowCount = ((0, List_js_1.length)(rows) | 0);
|
|
531
1211
|
const loop = (colI_mut, rows_2_mut) => {
|
|
532
1212
|
loop: while (true) {
|
|
533
1213
|
const colI = colI_mut, rows_2 = rows_2_mut;
|
|
@@ -542,7 +1222,7 @@ function Unchecked_alignByHeaders(keepOrder, rows) {
|
|
|
542
1222
|
if (keepOrder) {
|
|
543
1223
|
if (!(0, List_js_1.isEmpty)(l_1)) {
|
|
544
1224
|
if (Unchecked_compositeHeaderMainColumnEqual((0, List_js_1.head)(l_1)[0], firstElem)) {
|
|
545
|
-
(
|
|
1225
|
+
Unchecked_setCellAt(colI, rowI, (0, List_js_1.head)(l_1)[1], values);
|
|
546
1226
|
return (0, List_js_1.tail)(l_1);
|
|
547
1227
|
}
|
|
548
1228
|
else {
|
|
@@ -568,7 +1248,7 @@ function Unchecked_alignByHeaders(keepOrder, rows) {
|
|
|
568
1248
|
return newL;
|
|
569
1249
|
}
|
|
570
1250
|
else {
|
|
571
|
-
(
|
|
1251
|
+
Unchecked_setCellAt(colI, rowI, (0, Option_js_1.value)(firstMatch), values);
|
|
572
1252
|
return newL;
|
|
573
1253
|
}
|
|
574
1254
|
}
|