Adds Workspace Collection Context interface and token
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
export * from './property-structure-workspace-context.interface.js';
|
||||
export * from './publishable-workspace-context.interface.js';
|
||||
export * from './saveable-workspace-context.interface.js';
|
||||
export * from './workspace-collection-context.interface.js';
|
||||
export * from './workspace-collection-context.token.js';
|
||||
export * from './variant-workspace-context.token.js';
|
||||
export * from './workspace-context.interface.js';
|
||||
export * from './editable-workspace-context-base.js';
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { UmbWorkspaceContextInterface } from './workspace-context.interface.js';
|
||||
import type { Observable } from '@umbraco-cms/backoffice/external/rxjs';
|
||||
import type { UmbContentTypeModel, UmbContentTypePropertyStructureManager } from '@umbraco-cms/backoffice/content-type';
|
||||
|
||||
export interface UmbWorkspaceCollectionContextInterface<T extends UmbContentTypeModel>
|
||||
extends UmbWorkspaceContextInterface {
|
||||
contentTypeHasCollection: Observable<boolean>;
|
||||
getCollectionAlias(): string;
|
||||
structure: UmbContentTypePropertyStructureManager<T>;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
||||
import type { UmbContentTypeModel } from '@umbraco-cms/backoffice/content-type';
|
||||
import type {
|
||||
UmbWorkspaceContextInterface,
|
||||
UmbWorkspaceCollectionContextInterface,
|
||||
} from '@umbraco-cms/backoffice/workspace';
|
||||
|
||||
export const UMB_WORKSPACE_COLLECTION_CONTEXT = new UmbContextToken<
|
||||
UmbWorkspaceContextInterface,
|
||||
UmbWorkspaceCollectionContextInterface<UmbContentTypeModel>
|
||||
>(
|
||||
'UmbWorkspaceContext',
|
||||
undefined,
|
||||
(context): context is UmbWorkspaceCollectionContextInterface<UmbContentTypeModel> =>
|
||||
(context as UmbWorkspaceCollectionContextInterface<UmbContentTypeModel>).contentTypeHasCollection !== undefined,
|
||||
);
|
||||
Reference in New Issue
Block a user