@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,103 +1,492 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
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;
|
|
9
18
|
exports.$007CIsUniqueExistingHeader$007C_$007C = $007CIsUniqueExistingHeader$007C_$007C;
|
|
10
19
|
exports.tryFindDuplicateUnique = tryFindDuplicateUnique;
|
|
11
20
|
exports.tryFindDuplicateUniqueInArray = tryFindDuplicateUniqueInArray;
|
|
12
21
|
exports.SanityChecks_validateColumnIndex = SanityChecks_validateColumnIndex;
|
|
13
22
|
exports.SanityChecks_validateRowIndex = SanityChecks_validateRowIndex;
|
|
14
23
|
exports.SanityChecks_validateColumn = SanityChecks_validateColumn;
|
|
15
|
-
exports.
|
|
24
|
+
exports.SanityChecks_validateCellColumns = SanityChecks_validateCellColumns;
|
|
25
|
+
exports.SanityChecks_validateArcTableValues = SanityChecks_validateArcTableValues;
|
|
16
26
|
exports.Unchecked_tryGetCellAt = Unchecked_tryGetCellAt;
|
|
27
|
+
exports.Unchecked_getCellWithDefault = Unchecked_getCellWithDefault;
|
|
17
28
|
exports.Unchecked_setCellAt = Unchecked_setCellAt;
|
|
18
|
-
exports.
|
|
29
|
+
exports.Unchecked_removeCellAt = Unchecked_removeCellAt;
|
|
19
30
|
exports.Unchecked_moveCellTo = Unchecked_moveCellTo;
|
|
20
31
|
exports.Unchecked_removeHeader = Unchecked_removeHeader;
|
|
21
32
|
exports.Unchecked_removeColumnCells = Unchecked_removeColumnCells;
|
|
22
33
|
exports.Unchecked_removeColumnCells_withIndexChange = Unchecked_removeColumnCells_withIndexChange;
|
|
23
34
|
exports.Unchecked_removeRowCells = Unchecked_removeRowCells;
|
|
24
35
|
exports.Unchecked_removeRowCells_withIndexChange = Unchecked_removeRowCells_withIndexChange;
|
|
25
|
-
exports.
|
|
36
|
+
exports.Unchecked_removeRowRange_withIndexChange = Unchecked_removeRowRange_withIndexChange;
|
|
37
|
+
exports.Unchecked_moveColumnCellsTo = Unchecked_moveColumnCellsTo;
|
|
38
|
+
exports.Unchecked_addRefColumn = Unchecked_addRefColumn;
|
|
26
39
|
exports.Unchecked_addColumn = Unchecked_addColumn;
|
|
40
|
+
exports.Unchecked_addColumnFill = Unchecked_addColumnFill;
|
|
27
41
|
exports.Unchecked_fillMissingCells = Unchecked_fillMissingCells;
|
|
28
|
-
exports.
|
|
42
|
+
exports.Unchecked_addEmptyRow = Unchecked_addEmptyRow;
|
|
29
43
|
exports.Unchecked_addRow = Unchecked_addRow;
|
|
30
44
|
exports.Unchecked_addRows = Unchecked_addRows;
|
|
31
45
|
exports.Unchecked_compositeHeaderMainColumnEqual = Unchecked_compositeHeaderMainColumnEqual;
|
|
32
46
|
exports.Unchecked_moveColumnTo = Unchecked_moveColumnTo;
|
|
33
47
|
exports.Unchecked_alignByHeaders = Unchecked_alignByHeaders;
|
|
34
|
-
const Int32_js_1 = require("@fable-org/fable-library-js/Int32.js");
|
|
35
|
-
const MapUtil_js_1 = require("@fable-org/fable-library-js/MapUtil.js");
|
|
36
48
|
const CompositeCell_js_1 = require("./CompositeCell.js");
|
|
49
|
+
const Int32_js_1 = require("@fable-org/fable-library-js/Int32.js");
|
|
50
|
+
const Option_js_1 = require("@fable-org/fable-library-js/Option.js");
|
|
37
51
|
const Util_js_1 = require("@fable-org/fable-library-js/Util.js");
|
|
38
|
-
const
|
|
52
|
+
const MapUtil_js_1 = require("@fable-org/fable-library-js/MapUtil.js");
|
|
39
53
|
const Types_js_1 = require("@fable-org/fable-library-js/Types.js");
|
|
40
|
-
const
|
|
54
|
+
const Reflection_js_1 = require("@fable-org/fable-library-js/Reflection.js");
|
|
41
55
|
const Seq_js_1 = require("@fable-org/fable-library-js/Seq.js");
|
|
42
|
-
const
|
|
56
|
+
const Collections_js_1 = require("../Helper/Collections.js");
|
|
43
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");
|
|
44
60
|
const Double_js_1 = require("@fable-org/fable-library-js/Double.js");
|
|
45
61
|
const Array_js_1 = require("@fable-org/fable-library-js/Array.js");
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
function
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
|
|
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
|
+
}
|
|
55
96
|
}
|
|
56
97
|
else {
|
|
57
|
-
|
|
98
|
+
return CompositeCell_js_1.CompositeCell.emptyFreeText;
|
|
58
99
|
}
|
|
59
100
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
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
|
+
}
|
|
65
110
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
+
});
|
|
74
136
|
}
|
|
75
137
|
else {
|
|
76
138
|
return undefined;
|
|
77
139
|
}
|
|
78
140
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
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
|
+
}
|
|
81
153
|
}
|
|
82
|
-
function
|
|
83
|
-
if (
|
|
84
|
-
return 0;
|
|
154
|
+
function ColumnValueRefs__ToSparse_Z524259A4(this$, rowCount) {
|
|
155
|
+
if (this$.tag === /* Sparse */ 1) {
|
|
156
|
+
return ColumnValueRefs_Sparse(this$.fields[0]);
|
|
85
157
|
}
|
|
86
158
|
else {
|
|
87
|
-
|
|
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
|
+
}
|
|
183
|
+
}
|
|
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);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
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(), {
|
|
88
226
|
Compare: Util_js_1.comparePrimitives,
|
|
89
|
-
})
|
|
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]));
|
|
90
232
|
}
|
|
91
233
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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);
|
|
98
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);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
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));
|
|
99
478
|
}
|
|
100
|
-
|
|
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);
|
|
101
490
|
}
|
|
102
491
|
function $007CIsUniqueExistingHeader$007C_$007C(existingHeaders, input) {
|
|
103
492
|
switch (input.tag) {
|
|
@@ -202,63 +591,261 @@ function SanityChecks_validateRowIndex(index, rowCount, allowAppend) {
|
|
|
202
591
|
function SanityChecks_validateColumn(column) {
|
|
203
592
|
column.Validate(true);
|
|
204
593
|
}
|
|
205
|
-
function
|
|
206
|
-
let clo, clo_1;
|
|
594
|
+
function SanityChecks_validateCellColumns(headers, columns, raiseException) {
|
|
595
|
+
let clo, clo_1, clo_2;
|
|
207
596
|
let isValid = true;
|
|
208
|
-
let en = (0, Util_js_1.getEnumerator)(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
+
}
|
|
235
632
|
}
|
|
236
633
|
}
|
|
237
634
|
return isValid;
|
|
238
635
|
}
|
|
239
|
-
function
|
|
240
|
-
|
|
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);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
return isValid;
|
|
689
|
+
}
|
|
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
|
+
}
|
|
241
754
|
}
|
|
242
755
|
/**
|
|
243
756
|
* Add or update a cell in the dictionary.
|
|
244
757
|
*/
|
|
245
|
-
function Unchecked_setCellAt(columnIndex, rowIndex, c,
|
|
246
|
-
|
|
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
|
+
}
|
|
247
812
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
(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
|
+
}
|
|
253
840
|
}
|
|
254
|
-
function Unchecked_moveCellTo(fromCol, fromRow, toCol, toRow,
|
|
255
|
-
const matchValue =
|
|
841
|
+
function Unchecked_moveCellTo(fromCol, fromRow, toCol, toRow, values) {
|
|
842
|
+
const matchValue = Unchecked_tryGetCellAt(fromCol, fromRow, values);
|
|
256
843
|
if (matchValue == null) {
|
|
257
844
|
}
|
|
258
845
|
else {
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
846
|
+
const cell = (0, Option_js_1.value)(matchValue);
|
|
847
|
+
Unchecked_removeCellAt(fromCol, fromRow, values);
|
|
848
|
+
Unchecked_setCellAt(toCol, toRow, cell, values);
|
|
262
849
|
}
|
|
263
850
|
}
|
|
264
851
|
function Unchecked_removeHeader(index, headers) {
|
|
@@ -267,121 +854,161 @@ function Unchecked_removeHeader(index, headers) {
|
|
|
267
854
|
/**
|
|
268
855
|
* Remove cells of one Column, change index of cells with higher index to index - 1
|
|
269
856
|
*/
|
|
270
|
-
function Unchecked_removeColumnCells(
|
|
271
|
-
|
|
272
|
-
try {
|
|
273
|
-
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
274
|
-
const activePatternResult = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
275
|
-
const c = activePatternResult[0][0] | 0;
|
|
276
|
-
if (c === index) {
|
|
277
|
-
cells.delete([c, activePatternResult[0][1]]);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
finally {
|
|
282
|
-
(0, Util_js_1.disposeSafe)(enumerator);
|
|
283
|
-
}
|
|
857
|
+
function Unchecked_removeColumnCells(colIndex, values) {
|
|
858
|
+
values.Columns.delete(colIndex);
|
|
284
859
|
}
|
|
285
860
|
/**
|
|
286
861
|
* Remove cells of one Column, change index of cells with higher index to index - 1
|
|
287
862
|
*/
|
|
288
|
-
function Unchecked_removeColumnCells_withIndexChange(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
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]);
|
|
293
870
|
}
|
|
294
|
-
else if (
|
|
295
|
-
|
|
871
|
+
else if (cI < colIndex) {
|
|
872
|
+
(0, MapUtil_js_1.addToDict)(cols, cI, kv[1]);
|
|
296
873
|
}
|
|
297
|
-
}
|
|
874
|
+
}, values.Columns);
|
|
875
|
+
values.Columns = cols;
|
|
298
876
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
let enumerator = (0, Util_js_1.getEnumerator)(cells);
|
|
302
|
-
try {
|
|
303
|
-
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
304
|
-
const activePatternResult = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
305
|
-
const r = activePatternResult[0][1] | 0;
|
|
306
|
-
if (r === rowIndex) {
|
|
307
|
-
cells.delete([activePatternResult[0][0], r]);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
877
|
+
else {
|
|
878
|
+
const value = Unchecked_removeColumnCells(colIndex, values);
|
|
310
879
|
}
|
|
311
|
-
|
|
312
|
-
|
|
880
|
+
}
|
|
881
|
+
function Unchecked_removeRowCells(rowIndex, columnCount, values) {
|
|
882
|
+
for (let c = 0; c <= (columnCount - 1); c++) {
|
|
883
|
+
Unchecked_removeCellAt(c, rowIndex, values);
|
|
313
884
|
}
|
|
314
885
|
}
|
|
315
886
|
/**
|
|
316
887
|
* Remove cells of one Row, change index of cells with higher index to index - 1
|
|
317
888
|
*/
|
|
318
|
-
function Unchecked_removeRowCells_withIndexChange(rowIndex,
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
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
|
+
}
|
|
326
915
|
}
|
|
327
|
-
}
|
|
916
|
+
}, values.Columns);
|
|
917
|
+
values.RowCount = ((values.RowCount - 1) | 0);
|
|
328
918
|
}
|
|
329
919
|
}
|
|
330
920
|
/**
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
* `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
|
|
334
922
|
*/
|
|
335
|
-
function
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
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));
|
|
347
946
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
947
|
+
else {
|
|
948
|
+
for (let rowIndex = rowStartIndex; rowIndex <= rowEndIndex; rowIndex++) {
|
|
949
|
+
vals.delete(rowIndex);
|
|
950
|
+
}
|
|
351
951
|
}
|
|
352
|
-
default:
|
|
353
|
-
matchResult = 2;
|
|
354
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);
|
|
355
974
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
return CompositeCell_js_1.CompositeCell.emptyTerm;
|
|
359
|
-
case 1:
|
|
360
|
-
return CompositeCell_js_1.CompositeCell.emptyUnitized;
|
|
361
|
-
default:
|
|
362
|
-
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);
|
|
363
977
|
}
|
|
364
978
|
}
|
|
365
|
-
else {
|
|
366
|
-
return CompositeCell_js_1.CompositeCell.emptyFreeText;
|
|
367
|
-
}
|
|
368
979
|
}
|
|
369
980
|
/**
|
|
370
|
-
*
|
|
981
|
+
* Add a new column to the ArcTableValues.
|
|
371
982
|
*/
|
|
372
|
-
function
|
|
983
|
+
function Unchecked_addRefColumn(newHeader, newCol, rowCount, index, forceReplace, onlyHeaders, headers, values) {
|
|
373
984
|
let numberOfNewColumns = 1;
|
|
374
985
|
let index_1 = index;
|
|
375
986
|
const hasDuplicateUnique = tryFindDuplicateUnique(newHeader, headers);
|
|
376
987
|
if (!forceReplace && (hasDuplicateUnique != null)) {
|
|
377
988
|
throw new Error(`Invalid new column \`${newHeader}\`. Table already contains header of the same type on index \`${(0, Option_js_1.value)(hasDuplicateUnique)}\``);
|
|
378
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
|
+
}
|
|
379
1006
|
if (hasDuplicateUnique != null) {
|
|
380
1007
|
numberOfNewColumns = 0;
|
|
381
1008
|
index_1 = ((0, Option_js_1.value)(hasDuplicateUnique) | 0);
|
|
382
1009
|
}
|
|
383
|
-
const matchValue =
|
|
384
|
-
const matchValue_1 =
|
|
1010
|
+
const matchValue = headers.length | 0;
|
|
1011
|
+
const matchValue_1 = values.RowCount | 0;
|
|
385
1012
|
const startColCount = matchValue | 0;
|
|
386
1013
|
if (hasDuplicateUnique != null) {
|
|
387
1014
|
Unchecked_removeHeader(index_1, headers);
|
|
@@ -390,77 +1017,97 @@ function Unchecked_addColumn(newHeader, newCells, index, forceReplace, onlyHeade
|
|
|
390
1017
|
if ((index_1 < startColCount) && (hasDuplicateUnique == null)) {
|
|
391
1018
|
const lastColumnIndex = (0, Double_js_1.max)(startColCount - 1, 0) | 0;
|
|
392
1019
|
for (let columnIndex = lastColumnIndex; columnIndex >= index_1; columnIndex--) {
|
|
393
|
-
|
|
394
|
-
Unchecked_moveCellTo(columnIndex, rowIndex, columnIndex + numberOfNewColumns, rowIndex, values);
|
|
395
|
-
}
|
|
1020
|
+
Unchecked_moveColumnCellsTo(columnIndex, columnIndex + numberOfNewColumns, values);
|
|
396
1021
|
}
|
|
397
1022
|
}
|
|
398
1023
|
if (!onlyHeaders) {
|
|
399
|
-
|
|
400
|
-
|
|
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);
|
|
401
1032
|
}
|
|
402
|
-
const f = (index_1 >= startColCount) ? ((tupledArg) => ((values_1) => {
|
|
403
|
-
const value = (0, MapUtil_js_1.addToDict)(values_1, [tupledArg[0], tupledArg[1]], tupledArg[2]);
|
|
404
|
-
})) : ((tupledArg_1) => ((cells) => {
|
|
405
|
-
Unchecked_setCellAt(tupledArg_1[0], tupledArg_1[1], tupledArg_1[2], cells);
|
|
406
|
-
}));
|
|
407
|
-
(0, Array_js_1.iterateIndexed)((rowIndex_3, cell_1) => {
|
|
408
|
-
f([index_1, rowIndex_3, cell_1])(values);
|
|
409
|
-
}, newCells);
|
|
410
1033
|
}
|
|
411
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
|
+
}
|
|
412
1041
|
function Unchecked_fillMissingCells(headers, values) {
|
|
413
|
-
let
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
for (let rowIndex = 0; rowIndex <= (rowCount - 1); rowIndex++) {
|
|
441
|
-
if (!(0, Set_js_1.FSharpSet__Contains)(rowKeys, rowIndex)) {
|
|
442
|
-
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
|
+
}
|
|
443
1069
|
}
|
|
444
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
|
+
}
|
|
445
1075
|
}
|
|
446
1076
|
}
|
|
447
1077
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
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);
|
|
458
1104
|
}
|
|
459
1105
|
}
|
|
1106
|
+
values.RowCount = ((values.RowCount + 1) | 0);
|
|
460
1107
|
}
|
|
461
1108
|
function Unchecked_addRow(index, newCells, headers, values) {
|
|
462
|
-
const rowCount =
|
|
463
|
-
const columnCount =
|
|
1109
|
+
const rowCount = values.RowCount | 0;
|
|
1110
|
+
const columnCount = values.ColumnCount | 0;
|
|
464
1111
|
let increaseRowIndices;
|
|
465
1112
|
if (index < rowCount) {
|
|
466
1113
|
const lastRowIndex = (0, Double_js_1.max)(rowCount - 1, 0) | 0;
|
|
@@ -473,13 +1120,13 @@ function Unchecked_addRow(index, newCells, headers, values) {
|
|
|
473
1120
|
else {
|
|
474
1121
|
increaseRowIndices = undefined;
|
|
475
1122
|
}
|
|
476
|
-
const setNewCells = (0,
|
|
1123
|
+
const setNewCells = (0, Collections_js_1.ResizeArray_iteri)((columnIndex_1, cell) => {
|
|
477
1124
|
Unchecked_setCellAt(columnIndex_1, index, cell, values);
|
|
478
1125
|
}, newCells);
|
|
479
1126
|
}
|
|
480
1127
|
function Unchecked_addRows(index, newRows, headers, values) {
|
|
481
|
-
const rowCount =
|
|
482
|
-
const columnCount =
|
|
1128
|
+
const rowCount = values.RowCount | 0;
|
|
1129
|
+
const columnCount = values.ColumnCount | 0;
|
|
483
1130
|
const numNewRows = newRows.length | 0;
|
|
484
1131
|
let increaseRowIndices;
|
|
485
1132
|
if (index < rowCount) {
|
|
@@ -494,11 +1141,17 @@ function Unchecked_addRows(index, newRows, headers, values) {
|
|
|
494
1141
|
increaseRowIndices = undefined;
|
|
495
1142
|
}
|
|
496
1143
|
let currentRowIndex = index;
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
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);
|
|
502
1155
|
}
|
|
503
1156
|
}
|
|
504
1157
|
/**
|
|
@@ -512,7 +1165,7 @@ function Unchecked_compositeHeaderMainColumnEqual(ch1, ch2) {
|
|
|
512
1165
|
*
|
|
513
1166
|
* This function moves the column from `fromCol` to `toCol` and shifts all columns in between accordingly
|
|
514
1167
|
*/
|
|
515
|
-
function Unchecked_moveColumnTo(
|
|
1168
|
+
function Unchecked_moveColumnTo(fromCol, toCol, headers, values) {
|
|
516
1169
|
const patternInput = (fromCol < toCol) ? [-1, fromCol + 1, toCol] : [1, fromCol - 1, toCol];
|
|
517
1170
|
const shiftStart = patternInput[1] | 0;
|
|
518
1171
|
const shiftEnd = patternInput[2] | 0;
|
|
@@ -529,20 +1182,18 @@ function Unchecked_moveColumnTo(rowCount, fromCol, toCol, headers, values) {
|
|
|
529
1182
|
(0, Util_js_1.disposeSafe)(enumerator);
|
|
530
1183
|
}
|
|
531
1184
|
(0, Array_js_1.setItem)(headers, toCol, header);
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
values.set([c_1 + shift, r], (0, MapUtil_js_1.getItemFromDict)(values, [c_1, r]));
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
finally {
|
|
542
|
-
(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));
|
|
543
1191
|
}
|
|
544
|
-
values.set([toCol, r], cell);
|
|
545
1192
|
}
|
|
1193
|
+
finally {
|
|
1194
|
+
(0, Util_js_1.disposeSafe)(enumerator_1);
|
|
1195
|
+
}
|
|
1196
|
+
values.Columns.set(toCol, col);
|
|
546
1197
|
}
|
|
547
1198
|
/**
|
|
548
1199
|
* From a list of rows consisting of headers and values, creates a list of combined headers and the values as a sparse matrix
|
|
@@ -555,10 +1206,8 @@ function Unchecked_moveColumnTo(rowCount, fromCol, toCol, headers, values) {
|
|
|
555
1206
|
*/
|
|
556
1207
|
function Unchecked_alignByHeaders(keepOrder, rows) {
|
|
557
1208
|
const headers = [];
|
|
558
|
-
const values =
|
|
559
|
-
|
|
560
|
-
GetHashCode: Util_js_1.arrayHash,
|
|
561
|
-
});
|
|
1209
|
+
const values = ArcTableValues.init();
|
|
1210
|
+
values.RowCount = ((0, List_js_1.length)(rows) | 0);
|
|
562
1211
|
const loop = (colI_mut, rows_2_mut) => {
|
|
563
1212
|
loop: while (true) {
|
|
564
1213
|
const colI = colI_mut, rows_2 = rows_2_mut;
|
|
@@ -573,7 +1222,7 @@ function Unchecked_alignByHeaders(keepOrder, rows) {
|
|
|
573
1222
|
if (keepOrder) {
|
|
574
1223
|
if (!(0, List_js_1.isEmpty)(l_1)) {
|
|
575
1224
|
if (Unchecked_compositeHeaderMainColumnEqual((0, List_js_1.head)(l_1)[0], firstElem)) {
|
|
576
|
-
(
|
|
1225
|
+
Unchecked_setCellAt(colI, rowI, (0, List_js_1.head)(l_1)[1], values);
|
|
577
1226
|
return (0, List_js_1.tail)(l_1);
|
|
578
1227
|
}
|
|
579
1228
|
else {
|
|
@@ -599,7 +1248,7 @@ function Unchecked_alignByHeaders(keepOrder, rows) {
|
|
|
599
1248
|
return newL;
|
|
600
1249
|
}
|
|
601
1250
|
else {
|
|
602
|
-
(
|
|
1251
|
+
Unchecked_setCellAt(colI, rowI, (0, Option_js_1.value)(firstMatch), values);
|
|
603
1252
|
return newL;
|
|
604
1253
|
}
|
|
605
1254
|
}
|