Commit ea2f4c8
authored
improvement(tree): Update table schema APIs to make underlying data representation safer / more opaque (microsoft#25979)
## Data format change
Adds an extra layer to the table tree. The previous structure:
```typescript
{
columns: ListOfColumns;
rows: ListOfRows;
}
```
The new structure:
```typescript
{
table: {
columns: ListOfColumns;
rows: ListOfRows;
}
}
```
This extra root field/node will make future migrations to a new
underlying format easier (we can migrate the node under the `table`
field, rather than requiring the end-user to migrate the entire table
node under its parent field in the application schema).
## API Safety Improvements
Some editing operations on the `columns` and `rows` lists would allow
users to make edits that would violate table invariants. The canonical
example of this is deleting an entry from the `columns` list without
removing corresponding cells from the `rows` list (cells live under
`Row` nodes).
Instead, the `Table` schema offers a series of safe editing APIs for the
table as a whole (e.g., `deleteColumn`, which includes the deletion of
corresponding cells).
But we still wish to surface a subset of list-like editing options for
the two lists. For example, since the ordering of these lists is
intended to be significant, we would like to support rearrangement of
elements within these lists. We would also like for users to be able to
subscribe to shallow change notifications on the lists to learn when
items have been inserted/removed/moved.
`columns` and `rows` have had their typing updated to be more
restrictive (forbidding direct insertion, deletion, and moving items
_between_ lists), while still affording the subset of list functionality
that is safe in terms of table invariants.1 parent 1d33e00 commit ea2f4c8
File tree
12 files changed
+1407
-783
lines changed- examples
- data-objects/table-tree/src
- utils/import-testing/src/test
- packages
- dds/tree
- api-report
- src
- simple-tree
- api
- test
- snapshots/output/table-schema-json
- framework/fluid-framework/api-report
12 files changed
+1407
-783
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| |||
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
| 252 | + | |
251 | 253 | | |
252 | 254 | | |
253 | 255 | | |
| |||
0 commit comments