Skip to content

Commit ab6768c

Browse files
committed
hasProperties condition
1 parent fb16ade commit ab6768c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/packages/core/content-type/structure/content-type-structure-manager.class.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ export class UmbContentTypeStructureManager<
5454
// Notice this may need to use getValue to avoid resetting it self. [NL]
5555
return contentTypes.flatMap((x) => x.properties ?? []);
5656
});
57+
readonly contentTypeHasProperties = this.#contentTypes.asObservablePart((contentTypes) => {
58+
// Notice this may need to use getValue to avoid resetting it self. [NL]
59+
return contentTypes.some((x) => x.properties.length > 0);
60+
});
5761
readonly contentTypePropertyAliases = this.#contentTypes.asObservablePart((contentTypes) => {
5862
return contentTypes.flatMap((x) => x.properties ?? []).map((x) => x.alias);
5963
});

src/packages/core/content/workspace/views/edit/conditions/has-properties/content-has-properties.condition.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ export class UmbContentHasPropertiesWorkspaceCondition
1616

1717
this.consumeContext(UMB_CONTENT_WORKSPACE_CONTEXT, (context) => {
1818
this.observe(
19-
context.structure.contentTypes,
20-
(contentTypes) => {
21-
const hasProperties = contentTypes.some((contentType) => contentType.properties.length > 0);
19+
context.structure.contentTypeHasProperties,
20+
(hasProperties) => {
2221
this.permitted = hasProperties;
2322
},
24-
'contentTypesObserver',
23+
'hasPropertiesObserver',
2524
);
2625
});
2726
}

0 commit comments

Comments
 (0)