@fluidframework/tree 2.40.0 → 2.41.0-338186
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/api-report/tree.alpha.api.md +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js +0 -7
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +16 -14
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js +12 -18
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/index.d.ts +1 -1
- package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/index.js +1 -2
- package/dist/feature-libraries/flex-tree/index.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +1 -5
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +2 -16
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/utilities.d.ts +6 -6
- package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/utilities.js +6 -7
- package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +1 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +1 -2
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.d.ts +7 -3
- package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.js +11 -2
- package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +1 -1
- package/dist/shared-tree/schematizeTree.js +1 -1
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +3 -0
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +13 -7
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +1 -4
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +6 -1
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +5 -1
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +10 -11
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +2 -2
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts +1 -8
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +3 -14
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +3 -9
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +4 -4
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +9 -5
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/index.d.ts +3 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +6 -4
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +17 -20
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +2 -4
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts +30 -0
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -0
- package/dist/simple-tree/prepareForInsertion.js +137 -0
- package/dist/simple-tree/prepareForInsertion.js.map +1 -0
- package/dist/simple-tree/proxies.d.ts +1 -12
- package/dist/simple-tree/proxies.d.ts.map +1 -1
- package/dist/simple-tree/proxies.js +10 -106
- package/dist/simple-tree/proxies.js.map +1 -1
- package/dist/simple-tree/toMapTree.d.ts +1 -1
- package/dist/simple-tree/toMapTree.js +1 -1
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/tableSchema.d.ts +108 -59
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +93 -44
- package/dist/tableSchema.js.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js +0 -7
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +16 -14
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js +11 -16
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/index.d.ts +1 -1
- package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/index.js +1 -1
- package/lib/feature-libraries/flex-tree/index.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +1 -5
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +1 -14
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/utilities.d.ts +6 -6
- package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/utilities.js +6 -7
- package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +1 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.d.ts +7 -3
- package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.js +12 -3
- package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +1 -1
- package/lib/shared-tree/schematizeTree.js +1 -1
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +3 -0
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +14 -8
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +1 -4
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +7 -2
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +5 -1
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +8 -10
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +2 -2
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts +1 -8
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +2 -12
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +4 -10
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +4 -4
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +9 -5
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/index.d.ts +3 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +3 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +3 -6
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +4 -6
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts +30 -0
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -0
- package/lib/simple-tree/prepareForInsertion.js +131 -0
- package/lib/simple-tree/prepareForInsertion.js.map +1 -0
- package/lib/simple-tree/proxies.d.ts +1 -12
- package/lib/simple-tree/proxies.d.ts.map +1 -1
- package/lib/simple-tree/proxies.js +1 -96
- package/lib/simple-tree/proxies.js.map +1 -1
- package/lib/simple-tree/toMapTree.d.ts +1 -1
- package/lib/simple-tree/toMapTree.js +1 -1
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/tableSchema.d.ts +108 -59
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +94 -45
- package/lib/tableSchema.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +25 -25
- package/src/feature-libraries/default-schema/schemaChecker.ts +0 -8
- package/src/feature-libraries/flex-tree/context.ts +18 -20
- package/src/feature-libraries/flex-tree/index.ts +0 -1
- package/src/feature-libraries/flex-tree/lazyField.ts +2 -14
- package/src/feature-libraries/flex-tree/utilities.ts +8 -8
- package/src/feature-libraries/index.ts +0 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/checkoutFlexTreeView.ts +10 -6
- package/src/shared-tree/schematizeTree.ts +1 -1
- package/src/shared-tree/schematizingTreeView.ts +14 -14
- package/src/shared-tree/treeAlpha.ts +21 -5
- package/src/simple-tree/api/create.ts +15 -15
- package/src/simple-tree/api/index.ts +6 -2
- package/src/simple-tree/api/storedSchema.ts +2 -19
- package/src/simple-tree/arrayNode.ts +9 -20
- package/src/simple-tree/core/unhydratedFlexTree.ts +10 -5
- package/src/simple-tree/index.ts +6 -5
- package/src/simple-tree/mapNode.ts +8 -12
- package/src/simple-tree/objectNode.ts +3 -12
- package/src/simple-tree/prepareForInsertion.ts +236 -0
- package/src/simple-tree/proxies.ts +2 -147
- package/src/simple-tree/toMapTree.ts +1 -1
- package/src/tableSchema.ts +310 -158
package/dist/tableSchema.js
CHANGED
|
@@ -19,6 +19,32 @@ const index_js_2 = require("./simple-tree/index.js");
|
|
|
19
19
|
* The sub-scope applied to user-provided {@link SchemaFactory}s by table schema factories.
|
|
20
20
|
*/
|
|
21
21
|
const tableSchemaFactorySubScope = "table";
|
|
22
|
+
/**
|
|
23
|
+
* Gets the table containing the provided row/column node, if the node is part of a table.
|
|
24
|
+
* @remarks Assumes that the table is the grandparent of the row/column node.
|
|
25
|
+
*/
|
|
26
|
+
function getParentTable(rowOrColumnNode) {
|
|
27
|
+
const rowListNode = index_js_1.Tree.parent(rowOrColumnNode);
|
|
28
|
+
if (rowListNode === undefined || !(0, index_js_2.isArrayNodeSchema)(index_js_1.Tree.schema(rowListNode))) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
const tableNode = index_js_1.Tree.parent(rowListNode);
|
|
32
|
+
if (tableNode === undefined || !isTableNode(tableNode)) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
return tableNode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A private symbol put on table schema to help identify them.
|
|
39
|
+
*/
|
|
40
|
+
const tableSchemaSymbol = Symbol("tableNode");
|
|
41
|
+
/**
|
|
42
|
+
* Type-guard to determine if a node is a table node.
|
|
43
|
+
* @remarks Uses {@link tableSchemaSymbol} to identify table nodes.
|
|
44
|
+
*/
|
|
45
|
+
function isTableNode(node) {
|
|
46
|
+
return tableSchemaSymbol in index_js_1.Tree.schema(node);
|
|
47
|
+
}
|
|
22
48
|
/**
|
|
23
49
|
* Not intended for use outside of this package.
|
|
24
50
|
*
|
|
@@ -32,11 +58,11 @@ const tableSchemaFactorySubScope = "table";
|
|
|
32
58
|
var System_TableSchema;
|
|
33
59
|
(function (System_TableSchema) {
|
|
34
60
|
/**
|
|
35
|
-
* Factory for creating
|
|
61
|
+
* Factory for creating column schema.
|
|
36
62
|
* @system @internal
|
|
37
63
|
*/
|
|
38
64
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
39
|
-
function
|
|
65
|
+
function createColumnSchema(inputSchemaFactory, cellSchema, propsSchema) {
|
|
40
66
|
const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
|
|
41
67
|
// Note: `columnFields` is broken into two parts to work around a TypeScript bug
|
|
42
68
|
// that results in broken `.d.ts` output.
|
|
@@ -69,6 +95,23 @@ var System_TableSchema;
|
|
|
69
95
|
// Will make it easier to evolve this schema in the future.
|
|
70
96
|
allowUnknownOptionalFields: true,
|
|
71
97
|
}) {
|
|
98
|
+
getCells() {
|
|
99
|
+
const tableNode = getParentTable(this);
|
|
100
|
+
if (tableNode === undefined) {
|
|
101
|
+
throw new internal_2.UsageError(`Column with ID "${this.id}" is not contained in a table.`);
|
|
102
|
+
}
|
|
103
|
+
const result = [];
|
|
104
|
+
for (const row of tableNode.rows) {
|
|
105
|
+
const cell = row.getCell(this.id);
|
|
106
|
+
if (cell !== undefined) {
|
|
107
|
+
if (!index_js_1.Tree.is(cell, cellSchema)) {
|
|
108
|
+
throw new internal_2.UsageError("Parent table contains a cell with incompatible with this column.");
|
|
109
|
+
}
|
|
110
|
+
result.push({ rowId: row.id, cell: cell });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
72
115
|
}
|
|
73
116
|
// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
|
|
74
117
|
// for the private brand field of TreeNode.
|
|
@@ -78,14 +121,13 @@ var System_TableSchema;
|
|
|
78
121
|
const ColumnSchemaType = Column;
|
|
79
122
|
return ColumnSchemaType;
|
|
80
123
|
}
|
|
81
|
-
System_TableSchema.
|
|
124
|
+
System_TableSchema.createColumnSchema = createColumnSchema;
|
|
82
125
|
/**
|
|
83
|
-
* Factory for creating
|
|
84
|
-
*
|
|
126
|
+
* Factory for creating row schema.
|
|
85
127
|
* @sealed @internal
|
|
86
128
|
*/
|
|
87
129
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
88
|
-
function
|
|
130
|
+
function createRowSchema(inputSchemaFactory, cellSchema, propsSchema) {
|
|
89
131
|
const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
|
|
90
132
|
// Note: `rowFields` is broken into two parts to work around a TypeScript bug
|
|
91
133
|
// that results in broken `.d.ts` output.
|
|
@@ -139,6 +181,18 @@ var System_TableSchema;
|
|
|
139
181
|
this.cells.delete(columnId);
|
|
140
182
|
return cell;
|
|
141
183
|
}
|
|
184
|
+
getCells() {
|
|
185
|
+
const result = [];
|
|
186
|
+
for (const [columnId, cell] of this.cells.entries()) {
|
|
187
|
+
if (cell !== undefined) {
|
|
188
|
+
result.push({
|
|
189
|
+
columnId,
|
|
190
|
+
cell,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return result;
|
|
195
|
+
}
|
|
142
196
|
}
|
|
143
197
|
// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
|
|
144
198
|
// for the private brand field of TreeNode.
|
|
@@ -148,13 +202,13 @@ var System_TableSchema;
|
|
|
148
202
|
const RowSchemaType = Row;
|
|
149
203
|
return RowSchemaType;
|
|
150
204
|
}
|
|
151
|
-
System_TableSchema.
|
|
205
|
+
System_TableSchema.createRowSchema = createRowSchema;
|
|
152
206
|
/**
|
|
153
|
-
* Factory for creating
|
|
207
|
+
* Factory for creating table schema.
|
|
154
208
|
* @system @internal
|
|
155
209
|
*/
|
|
156
210
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
157
|
-
function
|
|
211
|
+
function createTableSchema(inputSchemaFactory, _cellSchema, columnSchema, rowSchema) {
|
|
158
212
|
const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
|
|
159
213
|
/**
|
|
160
214
|
* {@link Table} fields.
|
|
@@ -172,6 +226,9 @@ var System_TableSchema;
|
|
|
172
226
|
// Will make it easier to evolve this schema in the future.
|
|
173
227
|
allowUnknownOptionalFields: true,
|
|
174
228
|
}) {
|
|
229
|
+
static empty() {
|
|
230
|
+
return new this({ columns: [], rows: [] });
|
|
231
|
+
}
|
|
175
232
|
getColumn(id) {
|
|
176
233
|
// TypeScript is unable to narrow the types correctly here, hence the casts.
|
|
177
234
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
@@ -202,21 +259,10 @@ var System_TableSchema;
|
|
|
202
259
|
return inserted[0] ?? (0, internal_1.oob)();
|
|
203
260
|
}
|
|
204
261
|
insertColumns({ columns, index, }) {
|
|
205
|
-
// #region Input validation
|
|
206
262
|
// Ensure index is valid
|
|
207
263
|
if (index !== undefined) {
|
|
208
264
|
Table.validateInsertionIndex(index, this.columns);
|
|
209
265
|
}
|
|
210
|
-
// Check all of the columns being inserted an ensure the table does not already contain any with the same ID.
|
|
211
|
-
for (const column of columns) {
|
|
212
|
-
// TypeScript is unable to narrow the type of the column type correctly here, hence the casts below.
|
|
213
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
214
|
-
const maybeId = column.id;
|
|
215
|
-
if (maybeId !== undefined && this.containsColumnWithId(maybeId)) {
|
|
216
|
-
throw new internal_2.UsageError(`A column with ID "${column.id}" already exists in the table.`);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
// #endregion
|
|
220
266
|
// TypeScript is unable to narrow the column type correctly here, hence the casts below.
|
|
221
267
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
222
268
|
if (index === undefined) {
|
|
@@ -246,11 +292,6 @@ var System_TableSchema;
|
|
|
246
292
|
// Note: TypeScript is unable to narrow the type of the row type correctly here, hence the casts below.
|
|
247
293
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
248
294
|
for (const newRow of rows) {
|
|
249
|
-
// Check all of the rows being inserted an ensure the table does not already contain any with the same ID.
|
|
250
|
-
const maybeId = newRow.id;
|
|
251
|
-
if (maybeId !== undefined && this.containsRowWithId(maybeId)) {
|
|
252
|
-
throw new internal_2.UsageError(`A row with ID "${newRow.id}" already exists in the table.`);
|
|
253
|
-
}
|
|
254
295
|
// If the row contains cells, verify that the table contains the columns for those cells.
|
|
255
296
|
// Note: we intentionally hide `cells` on `IRow` to avoid leaking the internal data representation as much as possible, so we have to cast here.
|
|
256
297
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -401,13 +442,13 @@ var System_TableSchema;
|
|
|
401
442
|
containsColumnWithId(columnId) {
|
|
402
443
|
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
403
444
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
404
|
-
return (this.columns.find((column) => column.id === columnId) !==
|
|
405
|
-
undefined);
|
|
445
|
+
return (this.columns.find((column) => column.id === columnId) !== undefined);
|
|
406
446
|
}
|
|
407
447
|
containsRowWithId(rowId) {
|
|
408
448
|
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
409
449
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
410
|
-
return this.rows.find((row) => row.id === rowId) !==
|
|
450
|
+
return (this.rows.find((row) => row.id === rowId) !==
|
|
451
|
+
undefined);
|
|
411
452
|
}
|
|
412
453
|
/**
|
|
413
454
|
* Ensure that the specified index is a valid location for item insertion in the destination list.
|
|
@@ -425,6 +466,12 @@ var System_TableSchema;
|
|
|
425
466
|
}
|
|
426
467
|
}
|
|
427
468
|
}
|
|
469
|
+
// Set a private symbol on the schema class that marks it as having been generated by this factory.
|
|
470
|
+
// Column / Row functionality use this to validate that they are being used in a table.
|
|
471
|
+
// This is effectively a work-around that allows columns and rows to invoke table methods
|
|
472
|
+
// without having to pass the table as a parameter to their construction, which isn't possible.
|
|
473
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
474
|
+
Table[tableSchemaSymbol] = true;
|
|
428
475
|
// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
|
|
429
476
|
// for the private brand field of TreeNode.
|
|
430
477
|
// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.
|
|
@@ -434,7 +481,7 @@ var System_TableSchema;
|
|
|
434
481
|
// Return the table schema
|
|
435
482
|
return TableSchemaType;
|
|
436
483
|
}
|
|
437
|
-
System_TableSchema.
|
|
484
|
+
System_TableSchema.createTableSchema = createTableSchema;
|
|
438
485
|
// #endregion
|
|
439
486
|
})(System_TableSchema || (exports.System_TableSchema = System_TableSchema = {}));
|
|
440
487
|
/**
|
|
@@ -468,7 +515,7 @@ var System_TableSchema;
|
|
|
468
515
|
* value: schemaFactory.string,
|
|
469
516
|
* }) {}
|
|
470
517
|
*
|
|
471
|
-
* class Table extends TableSchema.
|
|
518
|
+
* class Table extends TableSchema.table({
|
|
472
519
|
* schemaFactory,
|
|
473
520
|
* cell: Cell,
|
|
474
521
|
* }) {}
|
|
@@ -493,17 +540,18 @@ var System_TableSchema;
|
|
|
493
540
|
* dataType: schemaFactory.optional(schemaFactory.string),
|
|
494
541
|
* }) {}
|
|
495
542
|
*
|
|
496
|
-
* class Column extends TableSchema.
|
|
543
|
+
* class Column extends TableSchema.column({
|
|
497
544
|
* schemaFactory,
|
|
545
|
+
* cell: Cell,
|
|
498
546
|
* props: ColumnProps,
|
|
499
547
|
* }) {}
|
|
500
548
|
*
|
|
501
|
-
* class Row extends TableSchema.
|
|
549
|
+
* class Row extends TableSchema.row({
|
|
502
550
|
* schemaFactory,
|
|
503
551
|
* cell: Cell,
|
|
504
552
|
* }) {}
|
|
505
553
|
*
|
|
506
|
-
* class Table extends TableSchema.
|
|
554
|
+
* class Table extends TableSchema.table({
|
|
507
555
|
* schemaFactory,
|
|
508
556
|
* cell: Cell,
|
|
509
557
|
* column: Column,
|
|
@@ -532,29 +580,30 @@ var TableSchema;
|
|
|
532
580
|
/**
|
|
533
581
|
* Overload implementation
|
|
534
582
|
*/
|
|
535
|
-
function
|
|
536
|
-
return System_TableSchema.
|
|
583
|
+
function column({ schemaFactory, cell, props = index_js_2.SchemaFactory.optional(index_js_2.SchemaFactory.null), }) {
|
|
584
|
+
return System_TableSchema.createColumnSchema(schemaFactory, cell, props);
|
|
537
585
|
}
|
|
538
|
-
TableSchema.
|
|
586
|
+
TableSchema.column = column;
|
|
539
587
|
/**
|
|
540
588
|
* Overload implementation
|
|
541
589
|
*/
|
|
542
|
-
function
|
|
543
|
-
return System_TableSchema.
|
|
590
|
+
function row({ schemaFactory, cell, props = index_js_2.SchemaFactory.optional(index_js_2.SchemaFactory.null), }) {
|
|
591
|
+
return System_TableSchema.createRowSchema(schemaFactory, cell, props);
|
|
544
592
|
}
|
|
545
|
-
TableSchema.
|
|
593
|
+
TableSchema.row = row;
|
|
546
594
|
/**
|
|
547
595
|
* Overload implementation
|
|
548
596
|
*/
|
|
549
|
-
function
|
|
597
|
+
function table({ schemaFactory, cell: cellSchema, column: columnSchema = column({
|
|
550
598
|
schemaFactory,
|
|
551
|
-
|
|
599
|
+
cell: cellSchema,
|
|
600
|
+
}), row: rowSchema = row({
|
|
552
601
|
schemaFactory,
|
|
553
|
-
cell,
|
|
602
|
+
cell: cellSchema,
|
|
554
603
|
}), }) {
|
|
555
|
-
return System_TableSchema.
|
|
604
|
+
return System_TableSchema.createTableSchema(schemaFactory, cellSchema, columnSchema, rowSchema);
|
|
556
605
|
}
|
|
557
|
-
TableSchema.
|
|
606
|
+
TableSchema.table = table;
|
|
558
607
|
// #endregion
|
|
559
608
|
})(TableSchema || (exports.TableSchema = TableSchema = {}));
|
|
560
609
|
//# sourceMappingURL=tableSchema.js.map
|