render segment name in input

This commit is contained in:
Mads Rasmussen
2025-04-01 13:27:18 +02:00
parent c8e9beffa1
commit 5a6d7326d8

View File

@@ -288,7 +288,7 @@ export class UmbWorkspaceSplitViewVariantSelectorElement<
data-mark="input:entity-name"
placeholder=${this.localize.term('placeholders_entername')}
label=${this.localize.term('placeholders_entername')}
.value=${this._name ?? ''}
.value=${this.#getNameValue()}
@input=${this.#handleInput}
required
?readonly=${this.#isReadOnlyCulture(this._activeVariant?.culture ?? null) ||
@@ -410,6 +410,12 @@ export class UmbWorkspaceSplitViewVariantSelectorElement<
`;
}
#getNameValue() {
// It is currently not possible to edit the name of a segment variant option. We render the name of the segment instead and set the input to readonly.
const segmentName = this.#isSegmentVariantOption(this._activeVariant) ? this._activeVariant?.segmentInfo?.name : '';
return segmentName ?? this._name ?? '';
}
#getVariantName(variantOption: VariantOptionModelType) {
if (variantOption.variant?.name) {
return variantOption.variant?.name;