Interface: EntryVariant<TProps>
Defined in: layout/bars/variants.ts:61
One variant, as one object. A consumer installs it through GanttOptions.variants; a plugin
installs the same shape through ctx.variants.add(variant). One type, two doors.
variants: [{ name: 'milestone', when: { milestone: true }, paint: milestoneBar, can: { resize: false } }]
Nothing here is stored on the Entry. A variant is a function of the row, resolved per Gantt, so two Gantts on one Dataset may paint the same row differently (I2).
Type Parameters
TProps
TProps = Record<string, unknown>
Properties
barLabels?
optionalbarLabels?:BarLabels
Defined in: layout/bars/variants.ts:94
What this variant's own bars print, and where. Merges key by key over the Gantt's own
barLabels (#421 C5): { policy: 'outside' } alone keeps the Gantt's own field,
and { field: 'hours' } alone keeps the Gantt's own policy. Omit it for no opinion — every
bar this variant draws then prints exactly what the Gantt's own barLabels says.
bars?
optionalbars?:BarProducer
Defined in: layout/bars/variants.ts:72
What shape it draws. Default: one Bar over the entry's whole span (wholeSpanUnlessSegments, ADR 0023,
ADR 0026).
capabilities?
optionalcapabilities?:Capabilities
Defined in: layout/bars/variants.ts:78
What you can do to it. One level under the consumer's own capabilities, one level over the
library rule. Answer undefined from a predicate for "no opinion".
css?
optionalcss?:string
Defined in: layout/bars/variants.ts:89
The rules this look needs, as CSS text — verbatim, no scoping done for you. A variant owns
bars, paint and can already; this is the fifth answer, the rules behind the class
paint names (ADR 0022 §5). view/ wraps every installed variant's css once in
@layer freegantt and writes it after the base sheet, so a variant's own rule cancels
.fg-bar's background and state ring at equal specificity, and an unlayered consumer rule
still beats it (ADR 0021).
Not rules — when is already the rule (ADR 0018's title). Not styles — that is
ElementDescription.style's own word, and view/styles.ts's. Not stylesheet — a variant
carries one fragment, and the library holds one sheet.
name
name:
string
Defined in: layout/bars/variants.ts:64
This variant's identity — the data-variant a consumer styles, and the registry key. It names
a DOM identity, never a stored value.
paint?
optionalpaint?:BarRenderer
Defined in: layout/bars/variants.ts:75
How it looks. A paint that names no content of its own — class, style or attrs alone —
decorates the library's own bar and keeps its label.
when?
optionalwhen?:EntryRule<TProps>
Defined in: layout/bars/variants.ts:69
Which rows wear it. Omit it to write a last resort, which answers for every row no rule
matches — core's own leaf is the shipped one, and omitting when is how a plugin re-skins
it. A last resort never outranks a rule that states a match, core's own summary included, so
a variant that means "every row, whatever else matches it" says when: () => true.