change varying labels in Content Type Designer

This commit is contained in:
Niels Lyngsø
2025-04-16 22:01:46 +02:00
parent 70bdabf9d6
commit b2ab769edc
2 changed files with 35 additions and 24 deletions

View File

@@ -137,6 +137,9 @@ export class UmbContentTypeDesignEditorPropertiesElement extends UmbLitElement {
@state()
private _ownerContentTypeVariesByCulture?: boolean;
@state()
private _ownerContentTypeVariesBySegment?: boolean;
@state()
private _newPropertyPath?: string;
@@ -179,6 +182,13 @@ export class UmbContentTypeDesignEditorPropertiesElement extends UmbLitElement {
},
'observeOwnerVariesByCulture',
);
this.observe(
workspaceContext.variesBySegment,
(variesBySegment) => {
this._ownerContentTypeVariesBySegment = variesBySegment;
},
'observeOwnerVariesBySegment',
);
});
this.observe(this.#propertyStructureHelper.propertyStructure, (propertyStructure) => {
this._properties = propertyStructure;
@@ -268,7 +278,8 @@ export class UmbContentTypeDesignEditorPropertiesElement extends UmbLitElement {
?sort-mode-active=${this._sortModeActive}
.propertyStructureHelper=${this.#propertyStructureHelper}
.property=${property}
.ownerVariesByCulture=${this._ownerContentTypeVariesByCulture}>
.ownerVariesByCulture=${this._ownerContentTypeVariesByCulture}
.ownerVariesBySegment=${this._ownerContentTypeVariesBySegment}>
</umb-content-type-design-editor-property>
`;
},

View File

@@ -65,6 +65,9 @@ export class UmbContentTypeDesignEditorPropertyElement extends UmbLitElement {
@property({ attribute: false })
public ownerVariesByCulture?: boolean;
@property({ attribute: false })
public ownerVariesBySegment?: boolean;
@property({ type: Boolean, reflect: true, attribute: '_inherited' })
public _inherited?: boolean;
@@ -330,7 +333,12 @@ export class UmbContentTypeDesignEditorPropertyElement extends UmbLitElement {
#renderVariantTags() {
if (!this.property) return nothing;
if (!this.property.variesByCulture && !this.property.variesBySegment) {
if (
this.ownerVariesByCulture &&
this.ownerVariesBySegment &&
!this.property.variesByCulture &&
!this.property.variesBySegment
) {
return html`
<uui-tag look="default">
<uui-icon name="icon-shared-value"></uui-icon> ${this.localize.term(
@@ -340,28 +348,20 @@ export class UmbContentTypeDesignEditorPropertyElement extends UmbLitElement {
`;
}
return html`
${this.property.variesByCulture
? html`<uui-tag look="default">
<uui-icon name="icon-shuffle"></uui-icon> ${this.localize.term('contentTypeEditor_cultureVariantLabel')}
</uui-tag>`
: html`<uui-tag look="default">
<uui-icon name="icon-shared-value"></uui-icon> ${this.localize.term(
'contentTypeEditor_cultureInvariantLabel',
)}
</uui-tag>`}
${this.property.variesBySegment
? html`<uui-tag look="default">
<uui-icon name="icon-shuffle"></uui-icon> ${this.localize.term('contentTypeEditor_segmentVariantLabel')}
</uui-tag>`
: html`
<uui-tag look="default">
<uui-icon name="icon-shared-value"></uui-icon> ${this.localize.term(
'contentTypeEditor_segmentInvariantLabel',
)}
</uui-tag>
`}
`;
if (this.ownerVariesByCulture && this.property.variesByCulture && !this.property.variesBySegment) {
return html`<uui-tag look="default">
<uui-icon name="icon-shuffle"></uui-icon> ${this.localize.term('contentTypeEditor_cultureInvariantLabel')}
</uui-tag>`;
}
if (this.ownerVariesBySegment && !this.property.variesByCulture && this.property.variesBySegment) {
return html`<uui-tag look="default">
<uui-icon name="icon-shuffle"></uui-icon> ${this.localize.term('contentTypeEditor_segmentInvariantLabel')}
</uui-tag>`;
}
// Not shared:
return nothing;
}
static override styles = [