@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.
Files changed (83) hide show
  1. package/README.md +16 -8
  2. package/dist/ts/cjs/ts/ARC.js +31 -20
  3. package/dist/ts/cjs/ts/Conversion.js +122 -76
  4. package/dist/ts/cjs/ts/Core/ArcTypes.js +1 -1
  5. package/dist/ts/cjs/ts/Core/Conversion.js +110 -43
  6. package/dist/ts/cjs/ts/Core/Data.js +4 -2
  7. package/dist/ts/cjs/ts/Core/Helper/Collections.js +69 -1
  8. package/dist/ts/cjs/ts/Core/OntologyAnnotation.js +27 -23
  9. package/dist/ts/cjs/ts/Core/Table/ArcTable.js +234 -217
  10. package/dist/ts/cjs/ts/Core/Table/ArcTableAux.js +904 -255
  11. package/dist/ts/cjs/ts/Core/Table/ArcTables.js +12 -19
  12. package/dist/ts/cjs/ts/Core/Table/CompositeColumn.js +4 -2
  13. package/dist/ts/cjs/ts/FileSystem/DefaultGitattributes.js +1 -1
  14. package/dist/ts/cjs/ts/Json/Decode.js +105 -0
  15. package/dist/ts/cjs/ts/Json/Encode.js +42 -0
  16. package/dist/ts/cjs/ts/Json/Table/ArcTable.js +100 -113
  17. package/dist/ts/cjs/ts/Json.js +46 -1
  18. package/dist/ts/cjs/ts/ROCrateIO.js +12 -1
  19. package/dist/ts/cjs/ts/Spreadsheet/AnnotationTable/ArcTable.js +15 -4
  20. package/dist/ts/cjs/ts/Spreadsheet/AnnotationTable/CompositeColumn.js +77 -6
  21. package/dist/ts/cjs/ts/Spreadsheet/ArcInvestigation.js +31 -15
  22. package/dist/ts/cjs/ts/Spreadsheet/DataMapTable/DataMapHeader.js +1 -1
  23. package/dist/ts/cjs/ts/Spreadsheet/Metadata/SparseTable.js +2 -5
  24. package/dist/ts/esm/ts/ARC.js +34 -23
  25. package/dist/ts/esm/ts/Conversion.js +128 -82
  26. package/dist/ts/esm/ts/Core/ArcTypes.js +1 -1
  27. package/dist/ts/esm/ts/Core/Conversion.js +112 -45
  28. package/dist/ts/esm/ts/Core/Data.js +7 -5
  29. package/dist/ts/esm/ts/Core/Helper/Collections.js +61 -1
  30. package/dist/ts/esm/ts/Core/OntologyAnnotation.js +29 -25
  31. package/dist/ts/esm/ts/Core/Table/ArcTable.js +243 -226
  32. package/dist/ts/esm/ts/Core/Table/ArcTableAux.js +897 -264
  33. package/dist/ts/esm/ts/Core/Table/ArcTables.js +15 -22
  34. package/dist/ts/esm/ts/Core/Table/CompositeColumn.js +5 -3
  35. package/dist/ts/esm/ts/FileSystem/DefaultGitattributes.js +1 -1
  36. package/dist/ts/esm/ts/Json/Decode.js +105 -3
  37. package/dist/ts/esm/ts/Json/Encode.js +42 -2
  38. package/dist/ts/esm/ts/Json/Table/ArcTable.js +108 -121
  39. package/dist/ts/esm/ts/Json.js +39 -0
  40. package/dist/ts/esm/ts/ROCrateIO.js +14 -3
  41. package/dist/ts/esm/ts/Spreadsheet/AnnotationTable/ArcTable.js +17 -7
  42. package/dist/ts/esm/ts/Spreadsheet/AnnotationTable/CompositeColumn.js +78 -9
  43. package/dist/ts/esm/ts/Spreadsheet/ArcInvestigation.js +33 -17
  44. package/dist/ts/esm/ts/Spreadsheet/DataMapTable/DataMapHeader.js +1 -1
  45. package/dist/ts/esm/ts/Spreadsheet/Metadata/SparseTable.js +3 -6
  46. package/dist/ts/types/ts/ARC.d.ts +2 -2
  47. package/dist/ts/types/ts/ARC.d.ts.map +1 -1
  48. package/dist/ts/types/ts/Conversion.d.ts +15 -16
  49. package/dist/ts/types/ts/Conversion.d.ts.map +1 -1
  50. package/dist/ts/types/ts/Core/ArcTypes.d.ts +2 -0
  51. package/dist/ts/types/ts/Core/ArcTypes.d.ts.map +1 -1
  52. package/dist/ts/types/ts/Core/Conversion.d.ts +14 -15
  53. package/dist/ts/types/ts/Core/Conversion.d.ts.map +1 -1
  54. package/dist/ts/types/ts/Core/Data.d.ts.map +1 -1
  55. package/dist/ts/types/ts/Core/Helper/Collections.d.ts +8 -0
  56. package/dist/ts/types/ts/Core/Helper/Collections.d.ts.map +1 -1
  57. package/dist/ts/types/ts/Core/OntologyAnnotation.d.ts +9 -0
  58. package/dist/ts/types/ts/Core/OntologyAnnotation.d.ts.map +1 -1
  59. package/dist/ts/types/ts/Core/Table/ArcTable.d.ts +35 -28
  60. package/dist/ts/types/ts/Core/Table/ArcTable.d.ts.map +1 -1
  61. package/dist/ts/types/ts/Core/Table/ArcTableAux.d.ts +83 -35
  62. package/dist/ts/types/ts/Core/Table/ArcTableAux.d.ts.map +1 -1
  63. package/dist/ts/types/ts/Core/Table/ArcTables.d.ts.map +1 -1
  64. package/dist/ts/types/ts/Core/Table/CompositeColumn.d.ts.map +1 -1
  65. package/dist/ts/types/ts/FileSystem/DefaultGitattributes.d.ts +1 -1
  66. package/dist/ts/types/ts/FileSystem/DefaultGitattributes.d.ts.map +1 -1
  67. package/dist/ts/types/ts/Json/Decode.d.ts +6 -0
  68. package/dist/ts/types/ts/Json/Decode.d.ts.map +1 -1
  69. package/dist/ts/types/ts/Json/Encode.d.ts +2 -0
  70. package/dist/ts/types/ts/Json/Encode.d.ts.map +1 -1
  71. package/dist/ts/types/ts/Json/Table/ArcTable.d.ts +4 -3
  72. package/dist/ts/types/ts/Json/Table/ArcTable.d.ts.map +1 -1
  73. package/dist/ts/types/ts/Json.d.ts +17 -0
  74. package/dist/ts/types/ts/Json.d.ts.map +1 -1
  75. package/dist/ts/types/ts/ROCrateIO.d.ts +1 -1
  76. package/dist/ts/types/ts/ROCrateIO.d.ts.map +1 -1
  77. package/dist/ts/types/ts/Spreadsheet/AnnotationTable/ArcTable.d.ts +5 -0
  78. package/dist/ts/types/ts/Spreadsheet/AnnotationTable/ArcTable.d.ts.map +1 -1
  79. package/dist/ts/types/ts/Spreadsheet/AnnotationTable/CompositeColumn.d.ts +7 -0
  80. package/dist/ts/types/ts/Spreadsheet/AnnotationTable/CompositeColumn.d.ts.map +1 -1
  81. package/dist/ts/types/ts/Spreadsheet/ArcInvestigation.d.ts.map +1 -1
  82. package/dist/ts/types/ts/Spreadsheet/Metadata/SparseTable.d.ts.map +1 -1
  83. package/package.json +1 -1
@@ -2,135 +2,144 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ArcTable = void 0;
4
4
  exports.ArcTable_$reflection = ArcTable_$reflection;
5
- exports.ArcTable_$ctor_76CAD84E = ArcTable_$ctor_76CAD84E;
6
- const CompositeHeader_js_1 = require("./CompositeHeader.js");
7
- const ArcTableAux_js_1 = require("./ArcTableAux.js");
5
+ exports.ArcTable_$ctor_2D310C9B = ArcTable_$ctor_2D310C9B;
8
6
  const Util_js_1 = require("@fable-org/fable-library-js/Util.js");
9
7
  const CompositeCell_js_1 = require("./CompositeCell.js");
10
- const MutableMap_js_1 = require("@fable-org/fable-library-js/MutableMap.js");
8
+ const ArcTableAux_js_1 = require("./ArcTableAux.js");
9
+ const CompositeHeader_js_1 = require("./CompositeHeader.js");
11
10
  const Option_js_1 = require("@fable-org/fable-library-js/Option.js");
12
11
  const Seq_js_1 = require("@fable-org/fable-library-js/Seq.js");
13
12
  const CompositeColumn_js_1 = require("./CompositeColumn.js");
14
13
  const Range_js_1 = require("@fable-org/fable-library-js/Range.js");
15
14
  const Collections_js_1 = require("../Helper/Collections.js");
16
- const MapUtil_js_1 = require("@fable-org/fable-library-js/MapUtil.js");
17
- const String_js_1 = require("@fable-org/fable-library-js/String.js");
18
- const Array_js_1 = require("@fable-org/fable-library-js/Array.js");
19
15
  const List_js_1 = require("@fable-org/fable-library-js/List.js");
20
16
  const System_Text_js_1 = require("@fable-org/fable-library-js/System.Text.js");
21
17
  const Types_js_1 = require("@fable-org/fable-library-js/Types.js");
22
- const Seq2_js_1 = require("@fable-org/fable-library-js/Seq2.js");
18
+ const Array_js_1 = require("@fable-org/fable-library-js/Array.js");
19
+ const MapUtil_js_1 = require("@fable-org/fable-library-js/MapUtil.js");
20
+ const String_js_1 = require("@fable-org/fable-library-js/String.js");
23
21
  const HashCodes_js_1 = require("../Helper/HashCodes.js");
24
22
  const Reflection_js_1 = require("@fable-org/fable-library-js/Reflection.js");
25
23
  class ArcTable {
26
- constructor(name, headers, values) {
27
- const valid = (0, ArcTableAux_js_1.SanityChecks_validate)(headers, values, true);
28
- this["name@21"] = name;
29
- this["headers@22"] = headers;
30
- this["values@23"] = values;
24
+ constructor(name, headers, columns) {
25
+ const headers_1 = (0, Option_js_1.defaultArg)(headers, []);
26
+ const columns_1 = (0, Option_js_1.defaultArg)(columns, []);
27
+ const valid = (0, ArcTableAux_js_1.SanityChecks_validateCellColumns)(headers_1, columns_1, true);
28
+ this._values = ArcTableAux_js_1.ArcTableValues.fromCellColumns(columns_1);
29
+ this._name = name;
30
+ this._headers = headers_1;
31
+ }
32
+ get ValueMap() {
33
+ const this$ = this;
34
+ return this$._values.ValueMap;
35
+ }
36
+ set ValueMap(valueMap) {
37
+ const this$ = this;
38
+ this$._values.ValueMap = valueMap;
39
+ }
40
+ get ColumnRefs() {
41
+ const this$ = this;
42
+ return this$._values.Columns;
43
+ }
44
+ set ColumnRefs(internalColumnRefs) {
45
+ const this$ = this;
46
+ this$._values.Columns = internalColumnRefs;
31
47
  }
32
48
  get Headers() {
33
49
  const this$ = this;
34
- return this$["headers@22"];
50
+ return this$._headers;
35
51
  }
36
52
  set Headers(newHeaders) {
37
53
  const this$ = this;
38
- (0, ArcTableAux_js_1.SanityChecks_validate)(newHeaders, this$["values@23"], true);
39
- this$["headers@22"] = newHeaders;
54
+ (0, ArcTableAux_js_1.SanityChecks_validateArcTableValues)(newHeaders, this$._values, true);
55
+ this$._headers = newHeaders;
40
56
  }
41
57
  get Values() {
42
58
  const this$ = this;
43
- return this$["values@23"];
44
- }
45
- set Values(newValues) {
46
- const this$ = this;
47
- (0, ArcTableAux_js_1.SanityChecks_validate)(this$["headers@22"], newValues, true);
48
- this$["values@23"] = newValues;
59
+ return this$._values;
49
60
  }
50
61
  get Name() {
51
62
  const this$ = this;
52
- return this$["name@21"];
63
+ return this$._name;
53
64
  }
54
65
  set Name(newName) {
55
66
  const this$ = this;
56
- this$["name@21"] = newName;
67
+ this$._name = newName;
57
68
  }
58
69
  static create(name, headers, values) {
59
70
  return new ArcTable(name, headers, values);
60
71
  }
61
72
  static init(name) {
62
- return new ArcTable(name, [], new MutableMap_js_1.Dictionary([], {
63
- Equals: Util_js_1.equalArrays,
64
- GetHashCode: Util_js_1.arrayHash,
65
- }));
66
- }
67
- static createFromHeaders(name, headers) {
68
- return ArcTable.create(name, headers, new MutableMap_js_1.Dictionary([], {
69
- Equals: Util_js_1.equalArrays,
70
- GetHashCode: Util_js_1.arrayHash,
71
- }));
73
+ return new ArcTable(name, [], []);
74
+ }
75
+ static fromArcTableValues(name, headers, values) {
76
+ const t = ArcTable.init(name);
77
+ t.Headers = headers;
78
+ t.ValueMap = values.ValueMap;
79
+ t.ColumnRefs = values.Columns;
80
+ t.RowCount = (values.RowCount | 0);
81
+ return t;
72
82
  }
73
83
  static createFromRows(name, headers, rows) {
74
- const t = ArcTable.createFromHeaders(name, headers);
84
+ const t = new ArcTable(name, headers);
75
85
  t.AddRows(rows);
76
86
  return t;
77
87
  }
78
88
  Validate(raiseException) {
79
89
  const this$ = this;
80
90
  const raiseException_1 = (0, Option_js_1.defaultArg)(raiseException, true);
81
- return (0, ArcTableAux_js_1.SanityChecks_validate)(this$.Headers, this$.Values, raiseException_1);
91
+ return (0, ArcTableAux_js_1.SanityChecks_validateArcTableValues)(this$.Headers, this$.Values, raiseException_1);
82
92
  }
83
93
  static validate(raiseException) {
84
94
  return (table) => table.Validate((0, Option_js_1.unwrap)(raiseException));
85
95
  }
86
96
  get ColumnCount() {
87
97
  const this$ = this;
88
- return (0, ArcTableAux_js_1.getColumnCount)(this$.Headers) | 0;
98
+ return this$.Headers.length | 0;
89
99
  }
90
100
  static columnCount(table) {
91
101
  return table.ColumnCount;
92
102
  }
93
103
  get RowCount() {
94
104
  const this$ = this;
95
- return (0, ArcTableAux_js_1.getRowCount)(this$.Values) | 0;
105
+ return this$._values.RowCount | 0;
106
+ }
107
+ set RowCount(newRowCount) {
108
+ const this$ = this;
109
+ this$._values.RowCount = (newRowCount | 0);
96
110
  }
97
111
  static rowCount(table) {
98
112
  return table.RowCount;
99
113
  }
114
+ static setRowCount(newRowCount) {
115
+ return (table) => {
116
+ const newTable = table.Copy();
117
+ newTable.RowCount = (newRowCount | 0);
118
+ return newTable;
119
+ };
120
+ }
100
121
  get Columns() {
101
122
  const this$ = this;
102
- return (0, Seq_js_1.toArray)((0, Seq_js_1.delay)(() => (0, Seq_js_1.map)((i) => this$.GetColumn(i), (0, Range_js_1.rangeDouble)(0, 1, this$.ColumnCount - 1))));
123
+ return Array.from((0, Seq_js_1.toArray)((0, Seq_js_1.delay)(() => (0, Seq_js_1.map)((i) => this$.GetColumn(i), (0, Range_js_1.rangeDouble)(0, 1, this$.ColumnCount - 1)))));
103
124
  }
104
125
  Copy() {
105
126
  const this$ = this;
106
127
  const nextHeaders = (0, Collections_js_1.ResizeArray_map)((h) => h.Copy(), this$.Headers);
107
- const nextValues = new MutableMap_js_1.Dictionary([], {
108
- Equals: Util_js_1.equalArrays,
109
- GetHashCode: Util_js_1.arrayHash,
110
- });
111
- (0, Seq_js_1.iterate)((tupledArg) => {
112
- const ci = tupledArg[0] | 0;
113
- const ri = tupledArg[1] | 0;
114
- (0, MapUtil_js_1.addToDict)(nextValues, [ci, ri], (0, MapUtil_js_1.getItemFromDict)(this$.Values, [ci, ri]).Copy());
115
- }, this$.Values.keys());
116
- return ArcTable.create(this$.Name, nextHeaders, nextValues);
128
+ const nextValues = this$._values.Copy();
129
+ return ArcTable.fromArcTableValues(this$.Name, nextHeaders, nextValues);
117
130
  }
118
131
  TryGetCellAt(column, row) {
119
132
  const this$ = this;
120
- return (0, ArcTableAux_js_1.Unchecked_tryGetCellAt)(column, row, this$.Values);
133
+ return (0, ArcTableAux_js_1.Unchecked_tryGetCellAt)(column, row, this$._values);
121
134
  }
122
135
  static tryGetCellAt(column, row) {
123
136
  return (table) => table.TryGetCellAt(column, row);
124
137
  }
125
138
  GetCellAt(column, row) {
126
139
  const this$ = this;
127
- try {
128
- return (0, MapUtil_js_1.getItemFromDict)(this$.Values, [column, row]);
129
- }
130
- catch (matchValue) {
131
- const arg_2 = this$.Name;
132
- return (0, String_js_1.toFail)((0, String_js_1.printf)("Unable to find cell for index: (%i, %i) in table %s"))(column)(row)(arg_2);
133
- }
140
+ (0, ArcTableAux_js_1.SanityChecks_validateColumnIndex)(column, this$.ColumnCount, false);
141
+ (0, ArcTableAux_js_1.SanityChecks_validateRowIndex)(row, this$.RowCount, false);
142
+ return (0, ArcTableAux_js_1.Unchecked_getCellWithDefault)(column, row, this$._headers, this$._values);
134
143
  }
135
144
  static getCellAt(column, row) {
136
145
  return (table) => table.GetCellAt(column, row);
@@ -168,7 +177,7 @@ class ArcTable {
168
177
  (0, ArcTableAux_js_1.SanityChecks_validateRowIndex)(rowIndex, this$.RowCount, false);
169
178
  c.ValidateAgainstHeader(this$.Headers[columnIndex], true);
170
179
  }
171
- (0, ArcTableAux_js_1.Unchecked_setCellAt)(columnIndex, rowIndex, c, this$.Values);
180
+ (0, ArcTableAux_js_1.Unchecked_setCellAt)(columnIndex, rowIndex, c, this$._values);
172
181
  }
173
182
  static updateCellAt(columnIndex, rowIndex, cell, skipValidation) {
174
183
  return (table) => {
@@ -183,7 +192,7 @@ class ArcTable {
183
192
  (0, ArcTableAux_js_1.SanityChecks_validateColumnIndex)(columnIndex, this$.ColumnCount, false);
184
193
  c.ValidateAgainstHeader(this$.Headers[columnIndex], true);
185
194
  }
186
- (0, ArcTableAux_js_1.Unchecked_setCellAt)(columnIndex, rowIndex, c, this$.Values);
195
+ (0, ArcTableAux_js_1.Unchecked_setCellAt)(columnIndex, rowIndex, c, this$._values);
187
196
  }
188
197
  static setCellAt(columnIndex, rowIndex, cell, skipValidation) {
189
198
  return (table) => {
@@ -195,7 +204,7 @@ class ArcTable {
195
204
  UpdateCellsBy(f, skipValidation) {
196
205
  const this$ = this;
197
206
  const skipValidation_1 = (0, Option_js_1.defaultArg)(skipValidation, false);
198
- let enumerator = (0, Util_js_1.getEnumerator)(this$.Values);
207
+ const enumerator = (0, Util_js_1.getEnumerator)(this$._values);
199
208
  try {
200
209
  while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
201
210
  const kv = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
@@ -206,7 +215,7 @@ class ArcTable {
206
215
  if (!skipValidation_1) {
207
216
  newCell.ValidateAgainstHeader(this$.Headers[ci], true);
208
217
  }
209
- (0, ArcTableAux_js_1.Unchecked_setCellAt)(ci, ri, newCell, this$.Values);
218
+ (0, ArcTableAux_js_1.Unchecked_setCellAt)(ci, ri, newCell, this$._values);
210
219
  }
211
220
  }
212
221
  finally {
@@ -230,7 +239,7 @@ class ArcTable {
230
239
  if (!skipValidation_1) {
231
240
  newCell.ValidateAgainstHeader(this$.Headers[columnIndex], true);
232
241
  }
233
- (0, ArcTableAux_js_1.Unchecked_setCellAt)(columnIndex, rowIndex, newCell, this$.Values);
242
+ (0, ArcTableAux_js_1.Unchecked_setCellAt)(columnIndex, rowIndex, newCell, this$._values);
234
243
  }
235
244
  static updateCellBy(columnIndex, rowIndex, f, skipValidation) {
236
245
  return (table) => {
@@ -253,14 +262,14 @@ class ArcTable {
253
262
  setHeader = (this$.Headers[index] = newHeader);
254
263
  }
255
264
  else if (forceConvertCells_1) {
256
- const convertedCells = newHeader.IsTermColumn ? (0, Array_js_1.map)((c_1) => {
265
+ const convertedCells = newHeader.IsTermColumn ? (0, Collections_js_1.ResizeArray_map)((c_1) => {
257
266
  if (c_1.isFreeText) {
258
267
  return c_1.ToTermCell();
259
268
  }
260
269
  else {
261
270
  return c_1;
262
271
  }
263
- }, c.Cells) : (0, Array_js_1.map)((c_2) => c_2.ToFreeTextCell(), c.Cells);
272
+ }, c.Cells) : (0, Collections_js_1.ResizeArray_map)((c_2) => c_2.ToFreeTextCell(), c.Cells);
264
273
  this$.UpdateColumn(index, newHeader, convertedCells);
265
274
  }
266
275
  else {
@@ -274,17 +283,14 @@ class ArcTable {
274
283
  return newTable;
275
284
  };
276
285
  }
277
- AddColumn(header, cells, index, forceReplace, skipFillMissing) {
286
+ AddColumn(header, cells, index, forceReplace) {
278
287
  const this$ = this;
279
288
  const index_1 = (0, Option_js_1.defaultArg)(index, this$.ColumnCount) | 0;
280
289
  const cells_1 = (0, Option_js_1.defaultArg)(cells, []);
281
290
  const forceReplace_1 = (0, Option_js_1.defaultArg)(forceReplace, false);
282
291
  (0, ArcTableAux_js_1.SanityChecks_validateColumnIndex)(index_1, this$.ColumnCount, true);
283
292
  (0, ArcTableAux_js_1.SanityChecks_validateColumn)(CompositeColumn_js_1.CompositeColumn.create(header, cells_1));
284
- (0, ArcTableAux_js_1.Unchecked_addColumn)(header, cells_1, index_1, forceReplace_1, false, this$.Headers, this$.Values);
285
- if (!(0, Util_js_1.equals)(skipFillMissing, true)) {
286
- (0, ArcTableAux_js_1.Unchecked_fillMissingCells)(this$.Headers, this$.Values);
287
- }
293
+ (0, ArcTableAux_js_1.Unchecked_addColumn)(header, cells_1, index_1, forceReplace_1, false, this$.Headers, this$._values);
288
294
  }
289
295
  static addColumn(header, cells, index, forceReplace) {
290
296
  return (table) => {
@@ -295,8 +301,11 @@ class ArcTable {
295
301
  }
296
302
  AddColumnFill(header, cell, index, forceReplace) {
297
303
  const this$ = this;
298
- const cells = (0, Array_js_1.initialize)(this$.RowCount, (_arg) => cell.Copy());
299
- this$.AddColumn(header, cells, (0, Option_js_1.unwrap)(index), (0, Option_js_1.unwrap)(forceReplace));
304
+ const index_1 = (0, Option_js_1.defaultArg)(index, this$.ColumnCount) | 0;
305
+ const forceReplace_1 = (0, Option_js_1.defaultArg)(forceReplace, false);
306
+ (0, ArcTableAux_js_1.SanityChecks_validateColumnIndex)(index_1, this$.ColumnCount, true);
307
+ (0, ArcTableAux_js_1.SanityChecks_validateColumn)(CompositeColumn_js_1.CompositeColumn.create(header, [cell]));
308
+ (0, ArcTableAux_js_1.Unchecked_addColumnFill)(header, cell, index_1, forceReplace_1, false, this$.Headers, this$._values);
300
309
  }
301
310
  static addColumnFill(header, cell, index, forceReplace) {
302
311
  return (table) => {
@@ -305,7 +314,7 @@ class ArcTable {
305
314
  return newTable;
306
315
  };
307
316
  }
308
- UpdateColumn(columnIndex, header, cells, skipFillMissing) {
317
+ UpdateColumn(columnIndex, header, cells) {
309
318
  const this$ = this;
310
319
  (0, ArcTableAux_js_1.SanityChecks_validateColumnIndex)(columnIndex, this$.ColumnCount, false);
311
320
  const column = CompositeColumn_js_1.CompositeColumn.create(header, (0, Option_js_1.unwrap)(cells));
@@ -316,14 +325,11 @@ class ArcTable {
316
325
  throw new Error(`Invalid input. Tried setting unique header \`${header_1}\`, but header of same type already exists at index ${(0, Option_js_1.value)(matchValue)}.`);
317
326
  }
318
327
  (0, ArcTableAux_js_1.Unchecked_removeHeader)(columnIndex, this$.Headers);
319
- (0, ArcTableAux_js_1.Unchecked_removeColumnCells)(columnIndex, this$.Values);
328
+ (0, ArcTableAux_js_1.Unchecked_removeColumnCells)(columnIndex, this$._values);
320
329
  this$.Headers.splice(columnIndex, 0, column.Header);
321
- (0, Array_js_1.iterateIndexed)((rowIndex, v) => {
322
- (0, ArcTableAux_js_1.Unchecked_setCellAt)(columnIndex, rowIndex, v, this$.Values);
330
+ (0, Collections_js_1.ResizeArray_iteri)((rowIndex, v) => {
331
+ (0, ArcTableAux_js_1.Unchecked_setCellAt)(columnIndex, rowIndex, v, this$._values);
323
332
  }, column.Cells);
324
- if (!(0, Util_js_1.equals)(skipFillMissing, true)) {
325
- (0, ArcTableAux_js_1.Unchecked_fillMissingCells)(this$.Headers, this$.Values);
326
- }
327
333
  }
328
334
  static updateColumn(columnIndex, header, cells) {
329
335
  return (table) => {
@@ -354,7 +360,7 @@ class ArcTable {
354
360
  return newTable;
355
361
  };
356
362
  }
357
- AddColumns(columns, index, forceReplace, skipFillMissing) {
363
+ AddColumns(columns, index, forceReplace) {
358
364
  const this$ = this;
359
365
  let index_1 = (0, Option_js_1.defaultArg)(index, this$.ColumnCount);
360
366
  const forceReplace_1 = (0, Option_js_1.defaultArg)(forceReplace, false);
@@ -368,24 +374,21 @@ class ArcTable {
368
374
  }, duplicates);
369
375
  throw new Error((0, Types_js_1.toString)(sb));
370
376
  }
371
- columns.forEach((x_2) => {
377
+ (0, Seq_js_1.iterate)((x_2) => {
372
378
  (0, ArcTableAux_js_1.SanityChecks_validateColumn)(x_2);
373
- });
374
- columns.forEach((col) => {
379
+ }, columns);
380
+ (0, Seq_js_1.iterate)((col) => {
375
381
  const prevHeadersCount = this$.Headers.length | 0;
376
- (0, ArcTableAux_js_1.Unchecked_addColumn)(col.Header, col.Cells, index_1, forceReplace_1, false, this$.Headers, this$.Values);
382
+ (0, ArcTableAux_js_1.Unchecked_addColumn)(col.Header, col.Cells, index_1, forceReplace_1, false, this$.Headers, this$._values);
377
383
  if (this$.Headers.length > prevHeadersCount) {
378
384
  index_1 = ((index_1 + 1) | 0);
379
385
  }
380
- });
381
- if (!(0, Util_js_1.equals)(skipFillMissing, true)) {
382
- (0, ArcTableAux_js_1.Unchecked_fillMissingCells)(this$.Headers, this$.Values);
383
- }
386
+ }, columns);
384
387
  }
385
- static addColumns(columns, index, skipFillMissing) {
388
+ static addColumns(columns, index) {
386
389
  return (table) => {
387
390
  const newTable = table.Copy();
388
- newTable.AddColumns(columns, (0, Option_js_1.unwrap)(index), undefined, (0, Option_js_1.unwrap)(skipFillMissing));
391
+ newTable.AddColumns(columns, (0, Option_js_1.unwrap)(index));
389
392
  return newTable;
390
393
  };
391
394
  }
@@ -394,7 +397,7 @@ class ArcTable {
394
397
  (0, ArcTableAux_js_1.SanityChecks_validateColumnIndex)(index, this$.ColumnCount, false);
395
398
  const columnCount = this$.ColumnCount | 0;
396
399
  (0, ArcTableAux_js_1.Unchecked_removeHeader)(index, this$.Headers);
397
- (0, ArcTableAux_js_1.Unchecked_removeColumnCells_withIndexChange)(index, columnCount, this$.RowCount, this$.Values);
400
+ (0, ArcTableAux_js_1.Unchecked_removeColumnCells_withIndexChange)(index, columnCount, this$._values);
398
401
  }
399
402
  static removeColumn(index) {
400
403
  return (table) => {
@@ -422,42 +425,59 @@ class ArcTable {
422
425
  return newTable;
423
426
  };
424
427
  }
425
- GetColumn(columnIndex) {
428
+ GetColumn(columnIndex, fillDefault) {
426
429
  const this$ = this;
430
+ const fillDefault_1 = (0, Option_js_1.defaultArg)(fillDefault, false);
427
431
  (0, ArcTableAux_js_1.SanityChecks_validateColumnIndex)(columnIndex, this$.ColumnCount, false);
428
432
  const h = this$.Headers[columnIndex];
429
- const cells = (0, Seq_js_1.toArray)((0, Seq_js_1.delay)(() => (0, Seq_js_1.collect)((i) => {
430
- const matchValue = this$.TryGetCellAt(columnIndex, i);
431
- if (matchValue != null) {
432
- return (0, Seq_js_1.singleton)((0, Option_js_1.value)(matchValue));
433
+ const cells = [];
434
+ if (this$.RowCount !== 0) {
435
+ const col = (0, MapUtil_js_1.getItemFromDict)(this$._values.Columns, columnIndex);
436
+ if (col.tag === /* Sparse */ 1) {
437
+ const vals = col.fields[0];
438
+ const emptyCell = (0, ArcTableAux_js_1.getEmptyCellForHeader)(h, undefined);
439
+ for (let rowIndex = 0; rowIndex <= (this$.RowCount - 1); rowIndex++) {
440
+ if (vals.has(rowIndex)) {
441
+ void (cells.push((0, MapUtil_js_1.getItemFromDict)(this$._values.ValueMap, (0, MapUtil_js_1.getItemFromDict)(vals, rowIndex))));
442
+ }
443
+ else if (fillDefault_1) {
444
+ void (cells.push(emptyCell));
445
+ }
446
+ else {
447
+ (0, String_js_1.toFail)((0, String_js_1.printf)("Could not return column: Unable to find cell for index: (%i, %i)"))(columnIndex)(rowIndex);
448
+ }
449
+ }
433
450
  }
434
451
  else {
435
- (0, String_js_1.toFail)((0, String_js_1.printf)("Unable to find cell for index: (%i, %i)"))(columnIndex)(i);
436
- return (0, Seq_js_1.empty)();
452
+ const valueHash = col.fields[0] | 0;
453
+ const c = (0, MapUtil_js_1.getItemFromDict)(this$._values.ValueMap, valueHash);
454
+ for (let i = 0; i <= (this$.RowCount - 1); i++) {
455
+ void (cells.push(c));
456
+ }
437
457
  }
438
- }, (0, Range_js_1.rangeDouble)(0, 1, this$.RowCount - 1))));
458
+ }
439
459
  return CompositeColumn_js_1.CompositeColumn.create(h, cells);
440
460
  }
441
- static getColumn(index) {
442
- return (table) => table.GetColumn(index);
461
+ static getColumn(index, fillDefault) {
462
+ return (table) => table.GetColumn(index, (0, Option_js_1.unwrap)(fillDefault));
443
463
  }
444
- TryGetColumnByHeader(header) {
464
+ TryGetColumnByHeader(header, fillDefault) {
445
465
  const this$ = this;
446
- return (0, Option_js_1.map)((i) => this$.GetColumn(i), (0, Seq_js_1.tryFindIndex)((x) => (0, Util_js_1.equals)(x, header), this$.Headers));
466
+ return (0, Option_js_1.map)((i) => this$.GetColumn(i, (0, Option_js_1.unwrap)(fillDefault)), (0, Seq_js_1.tryFindIndex)((x) => (0, Util_js_1.equals)(x, header), this$.Headers));
447
467
  }
448
- static tryGetColumnByHeader(header) {
449
- return (table) => table.TryGetColumnByHeader(header);
468
+ static tryGetColumnByHeader(header, fillDefault) {
469
+ return (table) => table.TryGetColumnByHeader(header, (0, Option_js_1.unwrap)(fillDefault));
450
470
  }
451
- TryGetColumnByHeaderBy(headerPredicate) {
471
+ TryGetColumnByHeaderBy(headerPredicate, fillDefault) {
452
472
  const this$ = this;
453
- return (0, Option_js_1.map)((i) => this$.GetColumn(i), (0, Seq_js_1.tryFindIndex)(headerPredicate, this$.Headers));
473
+ return (0, Option_js_1.map)((i) => this$.GetColumn(i, (0, Option_js_1.unwrap)(fillDefault)), (0, Seq_js_1.tryFindIndex)(headerPredicate, this$.Headers));
454
474
  }
455
- static tryGetColumnByHeaderBy(headerPredicate) {
456
- return (table) => table.TryGetColumnByHeaderBy(headerPredicate);
475
+ static tryGetColumnByHeaderBy(headerPredicate, fillDefault) {
476
+ return (table) => table.TryGetColumnByHeaderBy(headerPredicate, (0, Option_js_1.unwrap)(fillDefault));
457
477
  }
458
- GetColumnByHeader(header) {
478
+ GetColumnByHeader(header, fillDefault) {
459
479
  const this$ = this;
460
- const matchValue = this$.TryGetColumnByHeader(header);
480
+ const matchValue = this$.TryGetColumnByHeader(header, (0, Option_js_1.unwrap)(fillDefault));
461
481
  if (matchValue == null) {
462
482
  const arg = this$.Name;
463
483
  return (0, String_js_1.toFail)((0, String_js_1.printf)("Unable to find column with header in table %s: %O"))(arg)(header);
@@ -466,8 +486,8 @@ class ArcTable {
466
486
  return (0, Option_js_1.value)(matchValue);
467
487
  }
468
488
  }
469
- static getColumnByHeader(header) {
470
- return (table) => table.GetColumnByHeader(header);
489
+ static getColumnByHeader(header, fillDefault) {
490
+ return (table) => table.GetColumnByHeader(header, (0, Option_js_1.unwrap)(fillDefault));
471
491
  }
472
492
  TryGetInputColumn() {
473
493
  const this$ = this;
@@ -522,7 +542,7 @@ class ArcTable {
522
542
  (0, String_js_1.toFail)((0, String_js_1.printf)("Cannt move column. Invalid end column index: %i"))(endCol);
523
543
  }
524
544
  else {
525
- (0, ArcTableAux_js_1.Unchecked_moveColumnTo)(this$.RowCount, startCol, endCol, this$.Headers, this$.Values);
545
+ (0, ArcTableAux_js_1.Unchecked_moveColumnTo)(startCol, endCol, this$.Headers, this$._values);
526
546
  }
527
547
  }
528
548
  static moveColumn(startCol, endCol) {
@@ -535,22 +555,28 @@ class ArcTable {
535
555
  AddRow(cells, index) {
536
556
  const this$ = this;
537
557
  const index_1 = (0, Option_js_1.defaultArg)(index, this$.RowCount) | 0;
538
- const cells_1 = (cells == null) ? (0, Seq_js_1.toArray)((0, Seq_js_1.delay)(() => (0, Seq_js_1.collect)((columnIndex) => (0, Seq_js_1.singleton)((0, ArcTableAux_js_1.Unchecked_getEmptyCellForHeader)(this$.Headers[columnIndex], (0, ArcTableAux_js_1.Unchecked_tryGetCellAt)(columnIndex, 0, this$.Values))), (0, Range_js_1.rangeDouble)(0, 1, this$.ColumnCount - 1)))) : (0, Option_js_1.value)(cells);
539
558
  (0, ArcTableAux_js_1.SanityChecks_validateRowIndex)(index_1, this$.RowCount, true);
540
- const newCells = cells_1;
541
- const columnCount = this$.ColumnCount | 0;
542
- const newCellsCount = (0, Seq_js_1.length)(newCells) | 0;
543
- if (columnCount === 0) {
544
- throw new Error("Table contains no columns! Cannot add row to empty table!");
545
- }
546
- else if (newCellsCount !== columnCount) {
547
- throw new Error(`Cannot add a new row with ${newCellsCount} cells, as the table has ${columnCount} columns.`);
559
+ if (cells != null) {
560
+ const cells_1 = (0, Option_js_1.value)(cells);
561
+ const newCells = cells_1;
562
+ const columnCount = this$.ColumnCount | 0;
563
+ const newCellsCount = (0, Seq_js_1.length)(newCells) | 0;
564
+ if (columnCount === 0) {
565
+ throw new Error("Table contains no columns! Cannot add row to empty table!");
566
+ }
567
+ else if (newCellsCount !== columnCount) {
568
+ throw new Error(`Cannot add a new row with ${newCellsCount} cells, as the table has ${columnCount} columns.`);
569
+ }
570
+ for (let columnIndex = 0; columnIndex <= (this$.ColumnCount - 1); columnIndex++) {
571
+ const h = this$.Headers[columnIndex];
572
+ const column = CompositeColumn_js_1.CompositeColumn.create(h, [cells_1[columnIndex]]);
573
+ cells_1[columnIndex].ValidateAgainstHeader(h, true);
574
+ }
575
+ (0, ArcTableAux_js_1.Unchecked_addRow)(index_1, cells_1, this$.Headers, this$._values);
548
576
  }
549
- for (let columnIndex_1 = 0; columnIndex_1 <= (this$.ColumnCount - 1); columnIndex_1++) {
550
- const h_1 = this$.Headers[columnIndex_1];
551
- (0, ArcTableAux_js_1.SanityChecks_validateColumn)(CompositeColumn_js_1.CompositeColumn.create(h_1, [(0, Array_js_1.item)(columnIndex_1, cells_1)]));
577
+ else {
578
+ (0, ArcTableAux_js_1.Unchecked_addEmptyRow)(index_1, this$._values);
552
579
  }
553
- (0, ArcTableAux_js_1.Unchecked_addRow)(index_1, cells_1, this$.Headers, this$.Values);
554
580
  }
555
581
  static addRow(cells, index) {
556
582
  return (table) => {
@@ -571,12 +597,12 @@ class ArcTable {
571
597
  else if (newCellsCount !== columnCount) {
572
598
  throw new Error(`Cannot add a new row with ${newCellsCount} cells, as the table has ${columnCount} columns.`);
573
599
  }
574
- (0, Array_js_1.iterateIndexed)((i, cell) => {
600
+ (0, Collections_js_1.ResizeArray_iteri)((i, cell) => {
575
601
  const h = this$.Headers[i];
576
- (0, ArcTableAux_js_1.SanityChecks_validateColumn)(CompositeColumn_js_1.CompositeColumn.create(h, [cell]));
602
+ (0, ArcTableAux_js_1.SanityChecks_validateColumn)(CompositeColumn_js_1.CompositeColumn.create(h, (0, Collections_js_1.ResizeArray_singleton)(cell)));
577
603
  }, cells);
578
- (0, Array_js_1.iterateIndexed)((columnIndex, cell_1) => {
579
- (0, ArcTableAux_js_1.Unchecked_setCellAt)(columnIndex, rowIndex, cell_1, this$.Values);
604
+ (0, Collections_js_1.ResizeArray_iteri)((columnIndex, cell_1) => {
605
+ (0, ArcTableAux_js_1.Unchecked_setCellAt)(columnIndex, rowIndex, cell_1, this$._values);
580
606
  }, cells);
581
607
  }
582
608
  static updateRow(rowIndex, cells) {
@@ -612,7 +638,7 @@ class ArcTable {
612
638
  const this$ = this;
613
639
  let index_1 = (0, Option_js_1.defaultArg)(index, this$.RowCount);
614
640
  (0, ArcTableAux_js_1.SanityChecks_validateRowIndex)(index_1, this$.RowCount, true);
615
- rows.forEach((row) => {
641
+ (0, Collections_js_1.ResizeArray_iter)((row) => {
616
642
  const newCells = row;
617
643
  const columnCount = this$.ColumnCount | 0;
618
644
  const newCellsCount = (0, Seq_js_1.length)(newCells) | 0;
@@ -622,15 +648,21 @@ class ArcTable {
622
648
  else if (newCellsCount !== columnCount) {
623
649
  throw new Error(`Cannot add a new row with ${newCellsCount} cells, as the table has ${columnCount} columns.`);
624
650
  }
625
- });
626
- for (let idx = 0; idx <= (rows.length - 1); idx++) {
627
- const row_1 = (0, Array_js_1.item)(idx, rows);
628
- for (let columnIndex = 0; columnIndex <= (this$.ColumnCount - 1); columnIndex++) {
629
- const h = this$.Headers[columnIndex];
630
- (0, ArcTableAux_js_1.SanityChecks_validateColumn)(CompositeColumn_js_1.CompositeColumn.create(h, [(0, Array_js_1.item)(columnIndex, row_1)]));
651
+ }, rows);
652
+ let enumerator = (0, Util_js_1.getEnumerator)(rows);
653
+ try {
654
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
655
+ const row_1 = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
656
+ for (let columnIndex = 0; columnIndex <= (this$.ColumnCount - 1); columnIndex++) {
657
+ const h = this$.Headers[columnIndex];
658
+ row_1[columnIndex].ValidateAgainstHeader(h, true);
659
+ }
631
660
  }
632
661
  }
633
- (0, ArcTableAux_js_1.Unchecked_addRows)(index_1, rows, this$.Headers, this$.Values);
662
+ finally {
663
+ (0, Util_js_1.disposeSafe)(enumerator);
664
+ }
665
+ (0, ArcTableAux_js_1.Unchecked_addRows)(index_1, rows, this$.Headers, this$._values);
634
666
  }
635
667
  static addRows(rows, index) {
636
668
  return (table) => {
@@ -641,8 +673,10 @@ class ArcTable {
641
673
  }
642
674
  AddRowsEmpty(rowCount, index) {
643
675
  const this$ = this;
644
- const row = (0, Seq_js_1.toArray)((0, Seq_js_1.delay)(() => (0, Seq_js_1.collect)((columnIndex) => (0, Seq_js_1.singleton)((0, ArcTableAux_js_1.Unchecked_getEmptyCellForHeader)(this$.Headers[columnIndex], (0, ArcTableAux_js_1.Unchecked_tryGetCellAt)(columnIndex, 0, this$.Values))), (0, Range_js_1.rangeDouble)(0, 1, this$.ColumnCount - 1))));
645
- const rows = (0, Array_js_1.initialize)(rowCount, (_arg) => row);
676
+ let row;
677
+ const collection = (0, Seq_js_1.toArray)((0, Seq_js_1.delay)(() => (0, Seq_js_1.collect)((columnIndex) => (0, Seq_js_1.singleton)((0, ArcTableAux_js_1.getEmptyCellForHeader)(this$.Headers[columnIndex], (0, ArcTableAux_js_1.Unchecked_tryGetCellAt)(columnIndex, 0, this$._values))), (0, Range_js_1.rangeDouble)(0, 1, this$.ColumnCount - 1))));
678
+ row = Array.from(collection);
679
+ const rows = (0, Collections_js_1.ResizeArray_init)(rowCount, (_arg) => row);
646
680
  this$.AddRows(rows, (0, Option_js_1.unwrap)(index));
647
681
  }
648
682
  static addRowsEmpty(rowCount, index) {
@@ -655,7 +689,7 @@ class ArcTable {
655
689
  RemoveRow(index) {
656
690
  const this$ = this;
657
691
  (0, ArcTableAux_js_1.SanityChecks_validateRowIndex)(index, this$.RowCount, false);
658
- (0, ArcTableAux_js_1.Unchecked_removeRowCells_withIndexChange)(index, this$.ColumnCount, this$.RowCount, this$.Values);
692
+ (0, ArcTableAux_js_1.Unchecked_removeRowCells_withIndexChange)(index, this$._values);
659
693
  }
660
694
  static removeRow(index) {
661
695
  return (table) => {
@@ -688,31 +722,31 @@ class ArcTable {
688
722
  if (!(0, Util_js_1.equals)(SkipValidation, true)) {
689
723
  (0, ArcTableAux_js_1.SanityChecks_validateRowIndex)(rowIndex, this$.RowCount, false);
690
724
  }
691
- return (0, Seq_js_1.toArray)((0, Seq_js_1.delay)(() => (0, Seq_js_1.map)((columnIndex) => (0, Option_js_1.value)(this$.TryGetCellAt(columnIndex, rowIndex)), (0, Range_js_1.rangeDouble)(0, 1, this$.ColumnCount - 1))));
725
+ const collection = (0, Seq_js_1.toArray)((0, Seq_js_1.delay)(() => (0, Seq_js_1.map)((columnIndex) => this$.GetCellAt(columnIndex, rowIndex), (0, Range_js_1.rangeDouble)(0, 1, this$.ColumnCount - 1))));
726
+ return Array.from(collection);
692
727
  }
693
728
  static getRow(index) {
694
729
  return (table) => table.GetRow(index);
695
730
  }
696
- Join(table, index, joinOptions, forceReplace, skipFillMissing) {
731
+ Join(table, index, joinOptions, forceReplace) {
697
732
  const this$ = this;
698
733
  const joinOptions_1 = (0, Option_js_1.defaultArg)(joinOptions, "headers");
699
734
  const forceReplace_1 = (0, Option_js_1.defaultArg)(forceReplace, false);
700
- const skipFillMissing_1 = (0, Option_js_1.defaultArg)(skipFillMissing, false);
701
735
  let index_1 = (0, Option_js_1.defaultArg)(index, this$.ColumnCount);
702
736
  index_1 = (((index_1 === -1) ? this$.ColumnCount : index_1) | 0);
703
737
  (0, ArcTableAux_js_1.SanityChecks_validateColumnIndex)(index_1, this$.ColumnCount, true);
704
738
  const onlyHeaders = (0, Util_js_1.equals)(joinOptions_1, "headers");
705
739
  let columns;
706
740
  const pre = table.Columns;
707
- columns = ((joinOptions_1 === "withUnit") ? (0, Array_js_1.map)((c_1) => {
741
+ columns = ((joinOptions_1 === "withUnit") ? (0, Collections_js_1.ResizeArray_map)((c_1) => {
708
742
  const unitsOpt = c_1.TryGetColumnUnits();
709
743
  if (unitsOpt == null) {
710
744
  return new CompositeColumn_js_1.CompositeColumn(c_1.Header, []);
711
745
  }
712
746
  else {
713
- return new CompositeColumn_js_1.CompositeColumn(c_1.Header, (0, Array_js_1.map)((u) => CompositeCell_js_1.CompositeCell.createUnitized("", u), (0, Option_js_1.value)(unitsOpt)));
747
+ return new CompositeColumn_js_1.CompositeColumn(c_1.Header, (0, Collections_js_1.ResizeArray_map)((u) => CompositeCell_js_1.CompositeCell.createUnitized("", u), (0, Option_js_1.value)(unitsOpt)));
714
748
  }
715
- }, pre) : ((joinOptions_1 === "withValues") ? pre : (0, Array_js_1.map)((c) => (new CompositeColumn_js_1.CompositeColumn(c.Header, [])), pre)));
749
+ }, pre) : ((joinOptions_1 === "withValues") ? pre : (0, Collections_js_1.ResizeArray_map)((c) => (new CompositeColumn_js_1.CompositeColumn(c.Header, [])), pre)));
716
750
  const duplicates = (0, ArcTableAux_js_1.tryFindDuplicateUniqueInArray)((0, Seq_js_1.map)((x) => x.Header, columns));
717
751
  if (!(0, List_js_1.isEmpty)(duplicates)) {
718
752
  const sb = (0, System_Text_js_1.StringBuilder_$ctor)();
@@ -722,19 +756,16 @@ class ArcTable {
722
756
  }, duplicates);
723
757
  throw new Error((0, Types_js_1.toString)(sb));
724
758
  }
725
- columns.forEach((x_2) => {
759
+ (0, Collections_js_1.ResizeArray_iter)((x_2) => {
726
760
  (0, ArcTableAux_js_1.SanityChecks_validateColumn)(x_2);
727
- });
728
- columns.forEach((col) => {
761
+ }, columns);
762
+ (0, Collections_js_1.ResizeArray_iter)((col) => {
729
763
  const prevHeadersCount = this$.Headers.length | 0;
730
- (0, ArcTableAux_js_1.Unchecked_addColumn)(col.Header, col.Cells, index_1, forceReplace_1, onlyHeaders, this$.Headers, this$.Values);
764
+ (0, ArcTableAux_js_1.Unchecked_addColumn)(col.Header, col.Cells, index_1, forceReplace_1, onlyHeaders, this$.Headers, this$._values);
731
765
  if (this$.Headers.length > prevHeadersCount) {
732
766
  index_1 = ((index_1 + 1) | 0);
733
767
  }
734
- });
735
- if (!skipFillMissing_1) {
736
- (0, ArcTableAux_js_1.Unchecked_fillMissingCells)(this$.Headers, this$.Values);
737
- }
768
+ }, columns);
738
769
  }
739
770
  static join(table, index, joinOptions, forceReplace) {
740
771
  return (this$) => {
@@ -743,30 +774,30 @@ class ArcTable {
743
774
  return copy;
744
775
  };
745
776
  }
746
- AddProtocolTypeColumn(types, index) {
777
+ AddProtocolTypeColumn(types, index, forceReplace) {
747
778
  const this$ = this;
748
- const cells = (0, Option_js_1.map)((array) => (0, Array_js_1.map)(CompositeCell_js_1.CompositeCell_Term, array), types);
749
- this$.AddColumn((0, CompositeHeader_js_1.CompositeHeader_ProtocolType)(), (0, Option_js_1.unwrap)(cells), (0, Option_js_1.unwrap)(index));
779
+ const cells = (0, Option_js_1.map)((a) => (0, Collections_js_1.ResizeArray_map)(CompositeCell_js_1.CompositeCell_Term, a), types);
780
+ this$.AddColumn((0, CompositeHeader_js_1.CompositeHeader_ProtocolType)(), (0, Option_js_1.unwrap)(cells), (0, Option_js_1.unwrap)(index), (0, Option_js_1.unwrap)(forceReplace));
750
781
  }
751
- AddProtocolVersionColumn(versions, index) {
782
+ AddProtocolVersionColumn(versions, index, forceReplace) {
752
783
  const this$ = this;
753
- const cells = (0, Option_js_1.map)((array) => (0, Array_js_1.map)(CompositeCell_js_1.CompositeCell_FreeText, array), versions);
754
- this$.AddColumn((0, CompositeHeader_js_1.CompositeHeader_ProtocolVersion)(), (0, Option_js_1.unwrap)(cells), (0, Option_js_1.unwrap)(index));
784
+ const cells = (0, Option_js_1.map)((a) => (0, Collections_js_1.ResizeArray_map)(CompositeCell_js_1.CompositeCell_FreeText, a), versions);
785
+ this$.AddColumn((0, CompositeHeader_js_1.CompositeHeader_ProtocolVersion)(), (0, Option_js_1.unwrap)(cells), (0, Option_js_1.unwrap)(index), (0, Option_js_1.unwrap)(forceReplace));
755
786
  }
756
- AddProtocolUriColumn(uris, index) {
787
+ AddProtocolUriColumn(uris, index, forceReplace) {
757
788
  const this$ = this;
758
- const cells = (0, Option_js_1.map)((array) => (0, Array_js_1.map)(CompositeCell_js_1.CompositeCell_FreeText, array), uris);
759
- this$.AddColumn((0, CompositeHeader_js_1.CompositeHeader_ProtocolUri)(), (0, Option_js_1.unwrap)(cells), (0, Option_js_1.unwrap)(index));
789
+ const cells = (0, Option_js_1.map)((a) => (0, Collections_js_1.ResizeArray_map)(CompositeCell_js_1.CompositeCell_FreeText, a), uris);
790
+ this$.AddColumn((0, CompositeHeader_js_1.CompositeHeader_ProtocolUri)(), (0, Option_js_1.unwrap)(cells), (0, Option_js_1.unwrap)(index), (0, Option_js_1.unwrap)(forceReplace));
760
791
  }
761
- AddProtocolDescriptionColumn(descriptions, index) {
792
+ AddProtocolDescriptionColumn(descriptions, index, forceReplace) {
762
793
  const this$ = this;
763
- const cells = (0, Option_js_1.map)((array) => (0, Array_js_1.map)(CompositeCell_js_1.CompositeCell_FreeText, array), descriptions);
764
- this$.AddColumn((0, CompositeHeader_js_1.CompositeHeader_ProtocolDescription)(), (0, Option_js_1.unwrap)(cells), (0, Option_js_1.unwrap)(index));
794
+ const cells = (0, Option_js_1.map)((a) => (0, Collections_js_1.ResizeArray_map)(CompositeCell_js_1.CompositeCell_FreeText, a), descriptions);
795
+ this$.AddColumn((0, CompositeHeader_js_1.CompositeHeader_ProtocolDescription)(), (0, Option_js_1.unwrap)(cells), (0, Option_js_1.unwrap)(index), (0, Option_js_1.unwrap)(forceReplace));
765
796
  }
766
- AddProtocolNameColumn(names, index) {
797
+ AddProtocolNameColumn(names, index, forceReplace) {
767
798
  const this$ = this;
768
- const cells = (0, Option_js_1.map)((array) => (0, Array_js_1.map)(CompositeCell_js_1.CompositeCell_FreeText, array), names);
769
- this$.AddColumn((0, CompositeHeader_js_1.CompositeHeader_ProtocolREF)(), (0, Option_js_1.unwrap)(cells), (0, Option_js_1.unwrap)(index));
799
+ const cells = (0, Option_js_1.map)((a) => (0, Collections_js_1.ResizeArray_map)(CompositeCell_js_1.CompositeCell_FreeText, a), names);
800
+ this$.AddColumn((0, CompositeHeader_js_1.CompositeHeader_ProtocolREF)(), (0, Option_js_1.unwrap)(cells), (0, Option_js_1.unwrap)(index), (0, Option_js_1.unwrap)(forceReplace));
770
801
  }
771
802
  GetProtocolTypeColumn() {
772
803
  const this$ = this;
@@ -794,25 +825,31 @@ class ArcTable {
794
825
  }
795
826
  GetComponentColumns() {
796
827
  const this$ = this;
797
- return (0, Array_js_1.map)((h_1) => this$.GetColumnByHeader(h_1), (0, Seq_js_1.toArray)((0, Seq_js_1.filter)((h) => h.isComponent, this$.Headers)));
828
+ return (0, Collections_js_1.ResizeArray_choose)((h) => {
829
+ if (h.isComponent) {
830
+ return this$.GetColumnByHeader(h);
831
+ }
832
+ else {
833
+ return undefined;
834
+ }
835
+ }, this$.Headers);
836
+ }
837
+ RescanValueMap() {
838
+ const this$ = this;
839
+ this$._values.RescanValueMap();
798
840
  }
799
841
  static SplitByColumnValues(columnIndex) {
800
- return (table) => (0, Array_js_1.mapIndexed)((i, indexGroup) => {
801
- let headers;
802
- const collection = table.Headers;
803
- headers = Array.from(collection);
804
- const rows = (0, Array_js_1.map)((i_1) => table.GetRow(i_1, true), indexGroup);
842
+ return (table) => (0, Collections_js_1.ResizeArray_mapi)((i, indexGroup) => {
843
+ const headers = table.Headers;
844
+ const rows = (0, Collections_js_1.ResizeArray_map)((i_1) => table.GetRow(i_1, true), indexGroup);
805
845
  return ArcTable.createFromRows(table.Name, headers, rows);
806
- }, (0, Array_js_1.map)((tupledArg) => (0, Array_js_1.map)((tuple_1) => tuple_1[0], tupledArg[1]), (0, Seq2_js_1.Array_groupBy)((tuple) => tuple[1], (0, Array_js_1.indexed)(table.GetColumn(columnIndex).Cells), {
807
- Equals: Util_js_1.equals,
808
- GetHashCode: Util_js_1.safeHash,
809
- })));
846
+ }, (0, Collections_js_1.ResizeArray_map)((tupledArg) => (0, Collections_js_1.ResizeArray_map)((tuple_1) => tuple_1[0], tupledArg[1]), (0, Collections_js_1.ResizeArray_groupBy)((tuple) => tuple[1], (0, Collections_js_1.ResizeArray_indexed)(table.GetColumn(columnIndex, true).Cells))));
810
847
  }
811
848
  static SplitByColumnValuesByHeader(header) {
812
849
  return (table) => {
813
850
  const index = (0, Seq_js_1.tryFindIndex)((x) => (0, Util_js_1.equals)(x, header), table.Headers);
814
851
  if (index == null) {
815
- return [table.Copy()];
852
+ return (0, Collections_js_1.ResizeArray_singleton)(table.Copy());
816
853
  }
817
854
  else {
818
855
  const i = (0, Option_js_1.value)(index) | 0;
@@ -835,18 +872,23 @@ class ArcTable {
835
872
  }
836
873
  }, (0, Seq_js_1.indexed)(refTable_1.Headers)));
837
874
  refTable_1.RemoveColumns(nonProtocolColumns);
838
- (0, ArcTableAux_js_1.Unchecked_extendToRowCount)(annotationTable_1.RowCount, refTable_1.Headers, refTable_1.Values);
839
- const arr = annotationTable_1.Columns;
840
- for (let idx = 0; idx <= (arr.length - 1); idx++) {
841
- const c = (0, Array_js_1.item)(idx, arr);
842
- refTable_1.AddColumn(c.Header, c.Cells, undefined, true);
875
+ refTable_1.RowCount = (annotationTable_1.RowCount | 0);
876
+ let enumerator = (0, Util_js_1.getEnumerator)(annotationTable_1.Columns);
877
+ try {
878
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
879
+ const c = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
880
+ refTable_1.AddColumn(c.Header, c.Cells, undefined, true);
881
+ }
882
+ }
883
+ finally {
884
+ (0, Util_js_1.disposeSafe)(enumerator);
843
885
  }
844
886
  return refTable_1;
845
887
  }
846
888
  static append(table1, table2) {
847
- const getList = (t) => (0, Seq_js_1.toList)((0, Seq_js_1.delay)(() => (0, Seq_js_1.map)((row) => (0, Seq_js_1.toList)((0, Seq_js_1.delay)(() => (0, Seq_js_1.map)((col) => [t.Headers[col], (0, MapUtil_js_1.getItemFromDict)(t.Values, [col, row])], (0, Range_js_1.rangeDouble)(0, 1, t.ColumnCount - 1)))), (0, Range_js_1.rangeDouble)(0, 1, t.RowCount - 1))));
889
+ const getList = (t) => (0, Seq_js_1.toList)((0, Seq_js_1.delay)(() => (0, Seq_js_1.map)((row) => (0, Seq_js_1.toList)((0, Seq_js_1.mapIndexed)((i, c) => [t.Headers[i], c], t.GetRow(row, true))), (0, Range_js_1.rangeDouble)(0, 1, t.RowCount - 1))));
848
890
  const patternInput = (0, ArcTableAux_js_1.Unchecked_alignByHeaders)(false, (0, List_js_1.append)(getList(table1), getList(table2)));
849
- return ArcTable.create(table1.Name, patternInput[0], patternInput[1]);
891
+ return ArcTable.fromArcTableValues(table1.Name, patternInput[0], patternInput[1]);
850
892
  }
851
893
  toString() {
852
894
  const this$ = this;
@@ -854,33 +896,8 @@ class ArcTable {
854
896
  return (0, String_js_1.join)("\n", (0, Seq_js_1.toList)((0, Seq_js_1.delay)(() => (0, Seq_js_1.append)((0, Seq_js_1.singleton)(`Table: ${this$.Name}`), (0, Seq_js_1.delay)(() => (0, Seq_js_1.append)((0, Seq_js_1.singleton)("-------------"), (0, Seq_js_1.delay)(() => (0, Seq_js_1.append)((0, Seq_js_1.singleton)((0, String_js_1.join)("\t|\t", (0, Seq_js_1.map)(Types_js_1.toString, this$.Headers))), (0, Seq_js_1.delay)(() => ((rowCount > 50) ? (0, Seq_js_1.append)((0, Seq_js_1.map)((rowI) => (0, String_js_1.join)("\t|\t", (0, Seq_js_1.map)(Types_js_1.toString, this$.GetRow(rowI))), (0, Range_js_1.rangeDouble)(0, 1, 19)), (0, Seq_js_1.delay)(() => (0, Seq_js_1.append)((0, Seq_js_1.singleton)("..."), (0, Seq_js_1.delay)(() => (0, Seq_js_1.map)((rowI_1) => (0, String_js_1.join)("\t|\t", (0, Seq_js_1.map)(Types_js_1.toString, this$.GetRow(rowI_1))), (0, Range_js_1.rangeDouble)(rowCount - 20, 1, rowCount - 1)))))) : ((rowCount === 0) ? (0, Seq_js_1.singleton)("No rows") : (0, Seq_js_1.map)((rowI_2) => (0, String_js_1.join)("\t|\t", (0, Seq_js_1.map)(Types_js_1.toString, this$.GetRow(rowI_2))), (0, Range_js_1.rangeDouble)(0, 1, rowCount - 1)))))))))))));
855
897
  }
856
898
  StructurallyEquals(other) {
857
- let a, b;
858
899
  const this$ = this;
859
- const sort = (arg) => (0, Array_js_1.sortBy)((_arg) => _arg[0], Array.from(arg), {
860
- Compare: Util_js_1.compareArrays,
861
- });
862
- if ((this$.Name === other.Name) && ((a = this$.Headers, (b = other.Headers, ((0, Seq_js_1.length)(a) === (0, Seq_js_1.length)(b)) && (0, Seq_js_1.fold)((acc, e) => {
863
- if (acc) {
864
- return e;
865
- }
866
- else {
867
- return false;
868
- }
869
- }, true, (0, Seq_js_1.toList)((0, Seq_js_1.delay)(() => (0, Seq_js_1.map)((i) => (0, Util_js_1.equals)((0, Seq_js_1.item)(i, a), (0, Seq_js_1.item)(i, b)), (0, Range_js_1.rangeDouble)(0, 1, (0, Seq_js_1.length)(a) - 1))))))))) {
870
- const a_1 = sort(this$.Values);
871
- const b_1 = sort(other.Values);
872
- return ((0, Seq_js_1.length)(a_1) === (0, Seq_js_1.length)(b_1)) && (0, Seq_js_1.fold)((acc_1, e_1) => {
873
- if (acc_1) {
874
- return e_1;
875
- }
876
- else {
877
- return false;
878
- }
879
- }, true, (0, Seq_js_1.toList)((0, Seq_js_1.delay)(() => (0, Seq_js_1.map)((i_1) => (0, Util_js_1.equals)((0, Seq_js_1.item)(i_1, a_1), (0, Seq_js_1.item)(i_1, b_1)), (0, Range_js_1.rangeDouble)(0, 1, (0, Seq_js_1.length)(a_1) - 1)))));
880
- }
881
- else {
882
- return false;
883
- }
900
+ return (0, Util_js_1.safeHash)(this$) === (0, Util_js_1.safeHash)(other);
884
901
  }
885
902
  ReferenceEquals(other) {
886
903
  const this$ = this;
@@ -893,7 +910,7 @@ class ArcTable {
893
910
  }
894
911
  GetHashCode() {
895
912
  const this$ = this;
896
- const vHash = (0, ArcTableAux_js_1.boxHashValues)(this$.ColumnCount, this$.Values);
913
+ const vHash = (0, Util_js_1.safeHash)(this$._values) | 0;
897
914
  return (0, HashCodes_js_1.boxHashArray)([this$.Name, (0, HashCodes_js_1.boxHashSeq)(this$.Headers), vHash]) | 0;
898
915
  }
899
916
  }
@@ -901,6 +918,6 @@ exports.ArcTable = ArcTable;
901
918
  function ArcTable_$reflection() {
902
919
  return (0, Reflection_js_1.class_type)("ARCtrl.ArcTable", undefined, ArcTable);
903
920
  }
904
- function ArcTable_$ctor_76CAD84E(name, headers, values) {
905
- return new ArcTable(name, headers, values);
921
+ function ArcTable_$ctor_2D310C9B(name, headers, columns) {
922
+ return new ArcTable(name, headers, columns);
906
923
  }