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