cupertino-files / TableCategories
Class: TableCategories
Defined in: src/tst/categories.ts:218
Constructors
Constructor
new TableCategories(
store,object,uids):TableCategories
Defined in: src/tst/categories.ts:224
Parameters
store
object
uids
Returns
TableCategories
Properties
object
readonlyobject:IwaObject
Defined in: src/tst/categories.ts:221
The TST.GroupByArchive.
store
readonlystore:ObjectStore
Defined in: src/tst/categories.ts:219
Accessors
enabled
Get Signature
get enabled():
boolean
Defined in: src/tst/categories.ts:235
Whether the app is currently grouping rows by this definition.
Returns
boolean
id
Get Signature
get id():
bigint
Defined in: src/tst/categories.ts:230
Returns
bigint
Methods
aggregates()
aggregates():
ColumnAggregate[]
Defined in: src/tst/categories.ts:260
Per-group column summaries, where the table defines any.
Returns
describe()
describe():
string[]
Defined in: src/tst/categories.ts:467
Readable summary, one line per group.
Returns
string[]
flatGroups()
flatGroups():
CategoryGroup[]
Defined in: src/tst/categories.ts:300
Groups at every level, flattened, for callers that just want a list.
Returns
groupColumns()
groupColumns():
GroupColumn[]
Defined in: src/tst/categories.ts:244
The columns grouped by, outermost first.
Returns
groups()
groups():
CategoryGroup[]
Defined in: src/tst/categories.ts:294
The groups, as a tree.
The root node is not a group — it holds every row — so its children are returned as the top level.
Returns
regroup()
regroup(
valueAt):number
Defined in: src/tst/categories.ts:415
Re-sort rows into the groups their values now put them in.
verify says the cached tree has gone stale; this fixes it. Only membership moves — every group node, its identity and its value stay exactly as the app wrote them, and only the row index set inside each one is rewritten.
That restriction is what makes this safe to do offline. Deciding which rows belong to "Animal" is reading the grouping column and comparing values, which needs nothing this library cannot already do. Creating a group would mean minting a group identity, placing the node in whatever order the app sorts groups in, and populating the several per-column and per-row fields alongside the tree whose meaning no fixture explains. So a value with no group is refused rather than invented, and the tree is left untouched when that happens.
Returns how many rows moved. Regrouping data that has not changed moves none and rewrites the archive to the same bytes, which is how the tests check it.
Parameters
valueAt
(row, column) => GroupValue
Returns
number
Throws
RangeError if a row's value matches no existing group, or if the outermost grouping is bucketed rather than by value.
setEnabled()
setEnabled(
enabled):void
Defined in: src/tst/categories.ts:239
Parameters
enabled
boolean
Returns
void
verify()
verify(
valueAt):object[]
Defined in: src/tst/categories.ts:373
Check the cached tree against the data it claims to describe.
Grouping happens in the app. This library can change cells but does not regroup them, so a tree can go stale — and unlike a table of contents, a stale category tree is checkable, because the grouping column's values are right there. Returns the groups whose rows no longer all hold the group's value.
Comparison is on values, not rendered text: a boolean group is false where the cell renders as FALSE, and a date group is a Date where the cell renders in the document's format. Comparing the strings would report every boolean and date category as stale.
Only the outermost grouping column is checked, and only for GroupingType.BY_VALUE: a bucketed group ("dates in 1979") names the bucket, not any cell's value, so checking it means evaluating the bucketing formula.
Parameters
valueAt
(row, column) => GroupValue
Returns
object[]