Skip to main content

Interface: Entry<TProps>

Defined in: model/entry.ts:27

One row, as it stands now.

A member that does no work is a property. A member that computes, walks or allocates carries parentheses (ADR 0017, rule 4). So hasChildren and depth are properties, and children(), parent() and descendants() are methods — parent() answers one value and still carries parentheses, because it looks the row up.

There is no entry.update(): the Entry reads, and dataset.entries.update(id, edit) writes. There is no entry.variant: a variant is per Gantt, because two Gantts on one Dataset may install different ones. There is no removed flag: existence is entries.has(id).

Type Parameters​

TProps​

TProps = Record<string, unknown>

Properties​

depth​

readonly depth: number

Defined in: model/entry.ts:59

How many ancestors this row has. Read off a cached index, so it does no work here.


end?​

readonly optional end?: Instant

Defined in: model/entry.ts:38

Exclusive — see plans/01 §5. Omitted iff this Entry does not span (ADR 0012).


hasChildren​

readonly hasChildren: boolean

Defined in: model/entry.ts:48

Free: a cached index read, no allocation.


id​

readonly id: EntryId

Defined in: model/entry.ts:28


name​

readonly name: string

Defined in: model/entry.ts:34

Always a string, '' when no author gave this row a name — a booking with no title is still a row (#421 C5), and a reader should never write entry.name ?? '' to say so. The input and the stored record both stay sparse: EntryInput.name is optional, StoredEntry.name is omitted when unset, and entry.read('name') still answers undefined for a caller who has to tell "unnamed" from "named empty". This one accessor is what normalizes (#421).


start?​

readonly optional start?: Instant

Defined in: model/entry.ts:36

Omitted iff this Entry does not span (ADR 0012). Present with end iff it draws a bar.

Methods​

children()​

children(): readonly Entry<TProps>[]

Defined in: model/entry.ts:49

Returns​

readonly Entry<TProps>[]


descendants()​

descendants(): readonly Entry<TProps>[]

Defined in: model/entry.ts:52

Every Entry below this one, deepest included. It walks, so it carries parentheses.

Returns​

readonly Entry<TProps>[]


leaves()​

leaves(): readonly Entry<TProps>[]

Defined in: model/entry.ts:57

The bottom rows of this Entry's own subtree — every descendant with no children of its own. Includes this Entry itself when it has no children (Child / Descendant / Leaf, CONTEXT.md): a subtree of one leaf has one leaf, so leaves() on a childless row answers [this], never []. It walks, so it carries parentheses.

Returns​

readonly Entry<TProps>[]


parent()​

parent(): Entry<TProps> | undefined

Defined in: model/entry.ts:50

Returns​

Entry<TProps> | undefined


read()​

read<K>(field): FieldValue<TProps, K> | undefined

Defined in: model/entry.ts:45

The one by-key value door: a core key, a props key, or a compute Field. Every answer is live, and every answer is what its Field declares: a stored key answers the stored value, 'parentId' included, and a compute key answers what it computes (ADR 0024). The tree has its own doors — parent() and read('hierarchyParentId') — because a plugin-owned hierarchy (ADR 0020) can make the tree disagree with the stored parentId, on purpose.

Type Parameters​

K​

K extends FieldKey

Parameters​

field​

K

Returns​

FieldValue<TProps, K> | undefined


toInput()​

toInput(): EntryInput<TProps>

Defined in: model/entry.ts:64

The loose input shape, and exactly what entries.add() takes. It is how a row is copied: entries.add({ ...entry.toInput(), id: 'copy-1' }). It is not a second read door — nothing in a renderer, a rule or a capability calls it.

Returns​

EntryInput<TProps>