Made sections support computable titles and subtitles
This commit is contained in:
parent
4c4ff87110
commit
b89366de2a
1 changed files with 10 additions and 4 deletions
|
@ -237,9 +237,9 @@ export function createLayerTreeNode<T extends LayerTreeNodeOptions>(
|
||||||
/** An option object for a modifier display as a single section. **/
|
/** An option object for a modifier display as a single section. **/
|
||||||
export interface Section {
|
export interface Section {
|
||||||
/** The header for this modifier. **/
|
/** The header for this modifier. **/
|
||||||
title: string;
|
title: Computable<string>;
|
||||||
/** A subtitle for this modifier, e.g. to explain the context for the modifier. **/
|
/** A subtitle for this modifier, e.g. to explain the context for the modifier. **/
|
||||||
subtitle?: string;
|
subtitle?: Computable<string>;
|
||||||
/** The modifier to be displaying in this section. **/
|
/** The modifier to be displaying in this section. **/
|
||||||
modifier: WithRequired<Modifier, "description">;
|
modifier: WithRequired<Modifier, "description">;
|
||||||
/** The base value being modified. **/
|
/** The base value being modified. **/
|
||||||
|
@ -266,6 +266,8 @@ export function createCollapsibleModifierSections(
|
||||||
base: ProcessedComputable<DecimalSource | undefined>[];
|
base: ProcessedComputable<DecimalSource | undefined>[];
|
||||||
baseText: ProcessedComputable<CoercableComponent | undefined>[];
|
baseText: ProcessedComputable<CoercableComponent | undefined>[];
|
||||||
visible: ProcessedComputable<boolean | undefined>[];
|
visible: ProcessedComputable<boolean | undefined>[];
|
||||||
|
title: ProcessedComputable<string | undefined>[];
|
||||||
|
subtitle: ProcessedComputable<string | undefined>[];
|
||||||
}
|
}
|
||||||
| Record<string, never> = {};
|
| Record<string, never> = {};
|
||||||
let calculated = false;
|
let calculated = false;
|
||||||
|
@ -275,6 +277,8 @@ export function createCollapsibleModifierSections(
|
||||||
processed.base = sections.map(s => convertComputable(s.base));
|
processed.base = sections.map(s => convertComputable(s.base));
|
||||||
processed.baseText = sections.map(s => convertComputable(s.baseText));
|
processed.baseText = sections.map(s => convertComputable(s.baseText));
|
||||||
processed.visible = sections.map(s => convertComputable(s.visible));
|
processed.visible = sections.map(s => convertComputable(s.visible));
|
||||||
|
processed.title = sections.map(s => convertComputable(s.title));
|
||||||
|
processed.subtitle = sections.map(s => convertComputable(s.subtitle));
|
||||||
calculated = true;
|
calculated = true;
|
||||||
}
|
}
|
||||||
return sections;
|
return sections;
|
||||||
|
@ -297,8 +301,10 @@ export function createCollapsibleModifierSections(
|
||||||
>
|
>
|
||||||
▼
|
▼
|
||||||
</span>
|
</span>
|
||||||
{s.title}
|
{unref(processed.title)}
|
||||||
{s.subtitle != null ? <span class="subtitle"> ({s.subtitle})</span> : null}
|
{unref(processed.subtitle) != null ? (
|
||||||
|
<span class="subtitle"> ({unref(processed.subtitle)})</span>
|
||||||
|
) : null}
|
||||||
</h3>
|
</h3>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue