clean as part of refactor for simpler variant ctx

This commit is contained in:
Niels Lyngsø
2023-12-01 16:48:21 +01:00
parent 95aac3f848
commit f6caa8c565
2 changed files with 10 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
import type { UmbVariantId } from "../../variant/variant-id.class.js";
import type { Observable } from "@umbraco-cms/backoffice/external/rxjs";
import type { UmbVariantId } from '../../variant/variant-id.class.js';
import type { Observable } from '@umbraco-cms/backoffice/external/rxjs';
/**
* A variant context, represents a set of properties.
@@ -15,20 +15,21 @@ import type { Observable } from "@umbraco-cms/backoffice/external/rxjs";
* Also setting the name is an additional feature.
*/
export interface UmbVariantContext {
getType(): string;
getUnique(): string | undefined;
//getUniqueName(): string;
getVariantId: (() => UmbVariantId);
getVariantId: () => UmbVariantId;
getName(): string | undefined;
readonly name: Observable<string | undefined>;
// Should it be possible to get the properties as a list of property aliases?
//readonly properties: Observable<Array<string>>;
destroy(): void;
// Property methods:
propertyVariantId?: ((propertyAlias: string) => Promise<Observable<UmbVariantId | undefined>>);
propertyValueByAlias<ReturnType = unknown>(propertyAlias: string): Promise<Observable<ReturnType | undefined>>;
setPropertyValue(propertyAlias: string, value: unknown): Promise<void>;
propertyVariantId?: (propertyAlias: string) => Observable<UmbVariantId | undefined>;
propertyValueByAlias<ReturnType = unknown>(propertyAlias: string): Observable<ReturnType | undefined>;
setPropertyValue(propertyAlias: string, value: unknown): void;
}

View File

@@ -6,7 +6,6 @@ import type { Observable } from '@umbraco-cms/backoffice/external/rxjs';
export interface UmbInvariantableWorkspaceContextInterface<T = unknown>
extends UmbSaveableWorkspaceContextInterface<T> {
// Name:
getName(): string | undefined;
setName(name: string): void;
@@ -15,6 +14,6 @@ export interface UmbInvariantableWorkspaceContextInterface<T = unknown>
propertyValueByAlias<ReturnType = unknown>(alias: string): Promise<Observable<ReturnType | undefined>>;
getPropertyValue<ReturnType = unknown>(alias: string): ReturnType;
setPropertyValue(alias: string, value: unknown): Promise<void>;
createVariantContext(host: UmbControllerHost, variantId?: UmbVariantId): UmbVariantContext;
}