member + media corrections

This commit is contained in:
Niels Lyngsø
2024-03-13 16:21:07 +01:00
parent 11910bf62b
commit d896d1a8e7
5 changed files with 38 additions and 66 deletions

View File

@@ -48,20 +48,12 @@ export class UmbDocumentWorkspaceViewEditTabElement extends UmbLitElement {
this.consumeContext(UMB_DOCUMENT_WORKSPACE_CONTEXT, (workspaceContext) => {
this.#groupStructureHelper.setStructureManager(workspaceContext.structure);
});
this.observe(
this.#groupStructureHelper.containers,
(groups) => {
this._groups = groups;
},
null,
);
this.observe(
this.#groupStructureHelper.hasProperties,
(hasProperties) => {
this._hasProperties = hasProperties;
},
null,
);
this.observe(this.#groupStructureHelper.containers, (groups) => {
this._groups = groups;
});
this.observe(this.#groupStructureHelper.hasProperties, (hasProperties) => {
this._hasProperties = hasProperties;
});
}
render() {

View File

@@ -8,40 +8,33 @@ import type { PropertyTypeContainerModelBaseModel } from '@umbraco-cms/backoffic
import './media-workspace-view-edit-properties.element.js';
@customElement('umb-media-workspace-view-edit-tab')
export class UmbMediaWorkspaceViewEditTabElement extends UmbLitElement {
private _tabName?: string | undefined;
@property({ type: String })
public get tabName(): string | undefined {
return this._groupStructureHelper.getName();
return this.#groupStructureHelper.getName();
}
public set tabName(value: string | undefined) {
if (value === this._tabName) return;
const oldValue = this._tabName;
this._tabName = value;
this._groupStructureHelper.setName(value);
this.requestUpdate('tabName', oldValue);
const oldName = this.#groupStructureHelper.getName();
this.#groupStructureHelper.setName(value);
this.requestUpdate('tabName', oldName);
}
@property({ type: Boolean })
public get noTabName(): boolean {
return this._groupStructureHelper.getIsRoot();
return this.#groupStructureHelper.getIsRoot();
}
public set noTabName(value: boolean) {
this._groupStructureHelper.setIsRoot(value);
this.#groupStructureHelper.setIsRoot(value);
}
private _ownerTabId?: string | null;
@property({ type: String })
public get ownerTabId(): string | null | undefined {
return this._ownerTabId;
public get containerId(): string | null | undefined {
return this.#groupStructureHelper.getParentId();
}
public set ownerTabId(value: string | null | undefined) {
if (value === this._ownerTabId) return;
this._ownerTabId = value;
this._groupStructureHelper.setParentId(value);
public set containerId(value: string | null | undefined) {
this.#groupStructureHelper.setParentId(value);
}
_groupStructureHelper = new UmbContentTypeContainerStructureHelper<any>(this);
#groupStructureHelper = new UmbContentTypeContainerStructureHelper<any>(this);
@state()
_groups: Array<PropertyTypeContainerModelBaseModel> = [];
@@ -52,15 +45,13 @@ export class UmbMediaWorkspaceViewEditTabElement extends UmbLitElement {
constructor() {
super();
this._groupStructureHelper.setParentType('Tab');
this.consumeContext(UMB_MEDIA_WORKSPACE_CONTEXT, (workspaceContext) => {
this._groupStructureHelper.setStructureManager(workspaceContext.structure);
this.#groupStructureHelper.setStructureManager(workspaceContext.structure);
});
this.observe(this._groupStructureHelper.containers, (groups) => {
this.observe(this.#groupStructureHelper.containers, (groups) => {
this._groups = groups;
});
this.observe(this._groupStructureHelper.hasProperties, (hasProperties) => {
this.observe(this.#groupStructureHelper.hasProperties, (hasProperties) => {
this._hasProperties = hasProperties;
});
}

View File

@@ -78,8 +78,7 @@ export class UmbMediaWorkspaceViewEditElement extends UmbLitElement implements U
setup: (component) => {
(component as UmbMediaWorkspaceViewEditTabElement).tabName = tabName;
// TODO: Consider if we can link these more simple, and not parse this on.
(component as UmbMediaWorkspaceViewEditTabElement).ownerTabId =
this._tabsStructureHelper.isOwnerChildContainer(tab.id!) ? tab.id : undefined;
(component as UmbMediaWorkspaceViewEditTabElement).containerId = tab.id;
},
});
});
@@ -91,7 +90,7 @@ export class UmbMediaWorkspaceViewEditElement extends UmbLitElement implements U
component: () => import('./media-workspace-view-edit-tab.element.js'),
setup: (component) => {
(component as UmbMediaWorkspaceViewEditTabElement).noTabName = true;
(component as UmbMediaWorkspaceViewEditTabElement).ownerTabId = null;
(component as UmbMediaWorkspaceViewEditTabElement).containerId = null;
},
});
}

View File

@@ -8,40 +8,33 @@ import type { PropertyTypeContainerModelBaseModel } from '@umbraco-cms/backoffic
import './member-workspace-view-content-properties.element.js';
@customElement('umb-member-workspace-view-content-tab')
export class UmbMemberWorkspaceViewContentTabElement extends UmbLitElement {
private _tabName?: string | undefined;
@property({ type: String })
public get tabName(): string | undefined {
return this._groupStructureHelper.getName();
return this.#groupStructureHelper.getName();
}
public set tabName(value: string | undefined) {
if (value === this._tabName) return;
const oldValue = this._tabName;
this._tabName = value;
this._groupStructureHelper.setName(value);
this.requestUpdate('tabName', oldValue);
const oldName = this.#groupStructureHelper.getName();
this.#groupStructureHelper.setName(value);
this.requestUpdate('tabName', oldName);
}
@property({ type: Boolean })
public get noTabName(): boolean {
return this._groupStructureHelper.getIsRoot();
return this.#groupStructureHelper.getIsRoot();
}
public set noTabName(value: boolean) {
this._groupStructureHelper.setIsRoot(value);
this.#groupStructureHelper.setIsRoot(value);
}
private _ownerTabId?: string | null;
@property({ type: String })
public get ownerTabId(): string | null | undefined {
return this._ownerTabId;
public get containerId(): string | null | undefined {
return this.#groupStructureHelper.getParentId();
}
public set ownerTabId(value: string | null | undefined) {
if (value === this._ownerTabId) return;
this._ownerTabId = value;
this._groupStructureHelper.setParentId(value);
public set containerId(value: string | null | undefined) {
this.#groupStructureHelper.setParentId(value);
}
_groupStructureHelper = new UmbContentTypeContainerStructureHelper<any>(this);
#groupStructureHelper = new UmbContentTypeContainerStructureHelper<any>(this);
@state()
_groups: Array<PropertyTypeContainerModelBaseModel> = [];
@@ -52,15 +45,13 @@ export class UmbMemberWorkspaceViewContentTabElement extends UmbLitElement {
constructor() {
super();
this._groupStructureHelper.setParentType('Tab');
this.consumeContext(UMB_MEMBER_WORKSPACE_CONTEXT, (workspaceContext) => {
this._groupStructureHelper.setStructureManager(workspaceContext.structure);
this.#groupStructureHelper.setStructureManager(workspaceContext.structure);
});
this.observe(this._groupStructureHelper.containers, (groups) => {
this.observe(this.#groupStructureHelper.containers, (groups) => {
this._groups = groups;
});
this.observe(this._groupStructureHelper.hasProperties, (hasProperties) => {
this.observe(this.#groupStructureHelper.hasProperties, (hasProperties) => {
this._hasProperties = hasProperties;
});
}

View File

@@ -78,8 +78,7 @@ export class UmbMemberWorkspaceViewEditElement extends UmbLitElement implements
setup: (component) => {
(component as UmbMemberWorkspaceViewContentTabElement).tabName = tabName;
// TODO: Consider if we can link these more simple, and not parse this on.
(component as UmbMemberWorkspaceViewContentTabElement).ownerTabId =
this._tabsStructureHelper.isOwnerChildContainer(tab.id!) ? tab.id : undefined;
(component as UmbMemberWorkspaceViewContentTabElement).containerId = tab.id;
},
});
});
@@ -91,7 +90,7 @@ export class UmbMemberWorkspaceViewEditElement extends UmbLitElement implements
component: () => import('./member-workspace-view-content-tab.element.js'),
setup: (component) => {
(component as UmbMemberWorkspaceViewContentTabElement).noTabName = true;
(component as UmbMemberWorkspaceViewContentTabElement).ownerTabId = null;
(component as UmbMemberWorkspaceViewContentTabElement).containerId = null;
},
});
}