Skip to content

cupertino-files / TableCategories

Class: TableCategories

Defined in: src/tst/categories.ts:200

Constructors

Constructor

new TableCategories(store, object, uids): TableCategories

Defined in: src/tst/categories.ts:206

Parameters

store

ObjectStore

object

IwaObject

uids

ColumnRowUidMap

Returns

TableCategories

Properties

object

readonly object: IwaObject

Defined in: src/tst/categories.ts:203

The TST.GroupByArchive.


store

readonly store: ObjectStore

Defined in: src/tst/categories.ts:201

Accessors

enabled

Get Signature

get enabled(): boolean

Defined in: src/tst/categories.ts:217

Whether the app is currently grouping rows by this definition.

Returns

boolean


id

Get Signature

get id(): bigint

Defined in: src/tst/categories.ts:212

Returns

bigint

Methods

aggregates()

aggregates(): ColumnAggregate[]

Defined in: src/tst/categories.ts:242

Per-group column summaries, where the table defines any.

Returns

ColumnAggregate[]


describe()

describe(): string[]

Defined in: src/tst/categories.ts:449

Readable summary, one line per group.

Returns

string[]


flatGroups()

flatGroups(): CategoryGroup[]

Defined in: src/tst/categories.ts:282

Groups at every level, flattened, for callers that just want a list.

Returns

CategoryGroup[]


groupColumns()

groupColumns(): GroupColumn[]

Defined in: src/tst/categories.ts:226

The columns grouped by, outermost first.

Returns

GroupColumn[]


groups()

groups(): CategoryGroup[]

Defined in: src/tst/categories.ts:276

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

CategoryGroup[]


regroup()

regroup(valueAt): number

Defined in: src/tst/categories.ts:397

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:221

Parameters

enabled

boolean

Returns

void


verify()

verify(valueAt): object[]

Defined in: src/tst/categories.ts:355

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[]

MIT licensed. Independently made — not by Apple in California. Not affiliated with or endorsed by Apple Inc.