split view tidying
This commit is contained in:
@@ -12,9 +12,6 @@ export class UmbDocumentWorkspaceEditorElement extends UmbLitElement {
|
||||
//private _defaultVariant?: VariantViewModelBaseModel;
|
||||
private splitViewElement = new UmbDocumentWorkspaceSplitViewElement();
|
||||
|
||||
@state()
|
||||
_unique?: string;
|
||||
|
||||
@state()
|
||||
_routes?: Array<UmbRoute>;
|
||||
|
||||
@@ -38,17 +35,25 @@ export class UmbDocumentWorkspaceEditorElement extends UmbLitElement {
|
||||
|
||||
#observeVariants() {
|
||||
if (!this.#workspaceContext) return;
|
||||
this.observe(this.#workspaceContext.variants, (variants) => {
|
||||
this._availableVariants = variants;
|
||||
this._generateRoutes();
|
||||
});
|
||||
this.observe(
|
||||
this.#workspaceContext.variants,
|
||||
(variants) => {
|
||||
this._availableVariants = variants;
|
||||
this._generateRoutes();
|
||||
},
|
||||
'_observeVariants'
|
||||
);
|
||||
}
|
||||
|
||||
#observeSplitViews() {
|
||||
if (!this.#workspaceContext) return;
|
||||
this.observe(this.#workspaceContext.splitView.activeVariantsInfo, (variants) => {
|
||||
this._workspaceSplitViews = variants;
|
||||
});
|
||||
this.observe(
|
||||
this.#workspaceContext.splitView.activeVariantsInfo,
|
||||
(variants) => {
|
||||
this._workspaceSplitViews = variants;
|
||||
},
|
||||
'_observeSplitViews'
|
||||
);
|
||||
}
|
||||
|
||||
private _handleVariantFolderPart(index: number, folderPart: string) {
|
||||
@@ -110,10 +115,8 @@ export class UmbDocumentWorkspaceEditorElement extends UmbLitElement {
|
||||
};
|
||||
|
||||
render() {
|
||||
return this._routes
|
||||
? html`<umb-router-slot .routes=${this._routes} @init=${this._gotWorkspaceRoute}
|
||||
>${this.splitViewElement}</umb-router-slot
|
||||
>`
|
||||
return this._routes && this._routes.length > 0
|
||||
? html`<umb-router-slot .routes=${this._routes} @init=${this._gotWorkspaceRoute}></umb-router-slot>`
|
||||
: '';
|
||||
}
|
||||
|
||||
|
||||
@@ -16,12 +16,26 @@ export class UmbDocumentWorkspaceSplitViewElement extends UmbLitElement {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
console.log('##SPLIT VIEW');
|
||||
|
||||
this.consumeContext(UMB_ENTITY_WORKSPACE_CONTEXT, (context) => {
|
||||
this._workspaceContext = context as UmbDocumentWorkspaceContext;
|
||||
this._observeActiveVariantInfo();
|
||||
});
|
||||
}
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
|
||||
console.log('##SPLIT VIEW CONNECTED');
|
||||
}
|
||||
|
||||
disconnectedCallback(): void {
|
||||
super.disconnectedCallback();
|
||||
|
||||
console.log('##SPLIT VIEW DISCONNECTED!');
|
||||
}
|
||||
|
||||
private _observeActiveVariantInfo() {
|
||||
if (!this._workspaceContext) return;
|
||||
this.observe(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { UmbDocumentWorkspaceContext } from '../../document-workspace.context.js';
|
||||
import type { UmbDocumentWorkspaceViewEditTabElement } from './document-workspace-view-edit-tab.element.js';
|
||||
import { css, html, customElement, state, repeat } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UUITextStyles } from '@umbraco-cms/backoffice/external/uui';
|
||||
import { UmbContentTypeContainerStructureHelper } from '@umbraco-cms/backoffice/content-type';
|
||||
@@ -12,7 +13,6 @@ import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
import { PropertyTypeContainerModelBaseModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { UMB_ENTITY_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/workspace';
|
||||
import { UmbWorkspaceEditorViewExtensionElement } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import UmbDocumentWorkspaceViewEditTabElement from './document-workspace-view-edit-tab.element.js';
|
||||
|
||||
@customElement('umb-document-workspace-view-edit')
|
||||
export class UmbDocumentWorkspaceViewEditElement
|
||||
|
||||
Reference in New Issue
Block a user