arragement

This commit is contained in:
Niels Lyngsø
2024-01-16 12:18:31 +01:00
parent f66013afe3
commit 0939c10f2b
4 changed files with 15 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
import { UmbBlockDataType } from '../types.js';
import { UmbBlockElementPropertyDatasetContext } from './block-element-property-dataset.context.js';
import { UmbContentTypePropertyStructureManager } from '@umbraco-cms/backoffice/content-type';
import { UmbObjectState, UmbObserverController } from '@umbraco-cms/backoffice/observable-api';
import { UmbObjectState } from '@umbraco-cms/backoffice/observable-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbBaseController } from '@umbraco-cms/backoffice/class-api';
import { UmbDocumentTypeDetailRepository } from '@umbraco-cms/backoffice/document-type';
@@ -17,15 +17,13 @@ export class UmbBlockElementManager extends UmbBaseController {
readonly unique = this.#data.asObservablePart((data) => data?.udi);
readonly contentTypeId = this.#data.asObservablePart((data) => data?.contentTypeKey);
readonly structure;
readonly structure = new UmbContentTypePropertyStructureManager(this, new UmbDocumentTypeDetailRepository(this));
constructor(host: UmbControllerHost) {
// TODO: Get Workspace Alias via Manifest.
super(host);
this.structure = new UmbContentTypePropertyStructureManager(this, new UmbDocumentTypeDetailRepository(this));
new UmbObserverController(this, this.contentTypeId, (id) => this.structure.loadType(id));
this.observe(this.contentTypeId, (id) => this.structure.loadType(id));
}
setData(data: UmbBlockDataType | undefined) {

View File

@@ -28,16 +28,10 @@ export class UmbBlockWorkspaceContext<LayoutDataType extends UmbBlockLayoutBaseM
#layout = new UmbObjectState<LayoutDataType | undefined>(undefined);
readonly layout = this.#layout.asObservable();
// Consider not storing this here:
//#content = new UmbObjectState<UmbBlockDataType | undefined>(undefined);
//readonly content = this.#content.asObservable();
// Consider not storing this here:
//#settings = new UmbObjectState<UmbBlockDataType | undefined>(undefined);
//readonly settings = this.#settings.asObservable();
readonly contentUdi = this.#layout.asObservablePart((x) => x?.contentUdi);
readonly content = new UmbBlockElementManager(this);
readonly settings = new UmbBlockElementManager(this);
// TODO: Get the name of the contentElementType..
@@ -56,6 +50,8 @@ export class UmbBlockWorkspaceContext<LayoutDataType extends UmbBlockLayoutBaseM
this.observe(
context.layoutOf(unique),
(layoutData) => {
this.#layout.next(layoutData as LayoutDataType);
//
// Content:
const contentUdi = layoutData?.contentUdi;

View File

@@ -14,10 +14,12 @@ import { UmbBooleanState } from '@umbraco-cms/backoffice/observable-api';
type EntityType = DocumentTypeResponseModel;
export class UmbDocumentTypeWorkspaceContext
extends UmbEditableWorkspaceContextBase<UmbDocumentTypeDetailRepository, EntityType>
extends UmbEditableWorkspaceContextBase<EntityType>
implements UmbSaveableWorkspaceContextInterface
{
// Draft is located in structure manager
//
readonly repository = new UmbDocumentTypeDetailRepository(this);
// Data/Draft is located in structure manager
// General for content types:
readonly data;
@@ -38,15 +40,13 @@ export class UmbDocumentTypeWorkspaceContext
readonly defaultTemplateId;
readonly cleanup;
readonly structure;
readonly structure = new UmbContentTypePropertyStructureManager(this.host, this.repository);
#isSorting = new UmbBooleanState(undefined);
isSorting = this.#isSorting.asObservable();
constructor(host: UmbControllerHostElement) {
super(host, 'Umb.Workspace.DocumentType', new UmbDocumentTypeDetailRepository(host));
this.structure = new UmbContentTypePropertyStructureManager(this.host, this.repository);
super(host, 'Umb.Workspace.DocumentType');
// General for content types:
this.data = this.structure.ownerContentType;

View File

@@ -42,16 +42,13 @@ export class UmbDocumentWorkspaceContext
readonly urls = this.#currentData.asObservablePart((data) => data?.urls || []);
readonly templateId = this.#currentData.asObservablePart((data) => data?.templateId || null);
readonly structure;
readonly splitView;
readonly structure = new UmbContentTypePropertyStructureManager(this, new UmbDocumentTypeDetailRepository(this));
readonly splitView = new UmbWorkspaceSplitViewManager();
constructor(host: UmbControllerHost) {
// TODO: Get Workspace Alias via Manifest.
super(host, 'Umb.Workspace.Document');
this.structure = new UmbContentTypePropertyStructureManager(this, new UmbDocumentTypeDetailRepository(this));
this.splitView = new UmbWorkspaceSplitViewManager();
new UmbObserverController(this.host, this.contentTypeId, (id) => this.structure.loadType(id));
/*