UmbPropertyTypeWorkspaceContext

This commit is contained in:
Niels Lyngsø
2024-01-04 14:18:48 +01:00
parent 9a99918b4e
commit 20895dc5f3
3 changed files with 7 additions and 9 deletions

View File

@@ -7,12 +7,9 @@ import { UmbBaseController } from '@umbraco-cms/backoffice/class-api';
* This is a very simplified workspace context, just to serve one for the imitated property type workspace. (As its not a real workspace)
*/
export class UmbPropertyTypeWorkspaceContext extends UmbBaseController implements UmbWorkspaceContextInterface {
#id: string;
constructor(host: UmbControllerHostElement, id: string) {
constructor(host: UmbControllerHostElement) {
// TODO: We don't need a repo here, so maybe we should not require this of the UmbEditableWorkspaceContextBase
super(host, 'UmbWorkspaceContext');
this.#id = id;
}
get workspaceAlias() {
@@ -20,7 +17,7 @@ export class UmbPropertyTypeWorkspaceContext extends UmbBaseController implement
}
getEntityId() {
return this.#id;
return undefined;
}
getEntityType() {

View File

@@ -49,6 +49,8 @@ export class UmbPropertySettingsModalElement extends UmbModalBaseElement<
protected _originalPropertyData!: UmbPropertySettingsModalValue;
#context = new UmbPropertyTypeWorkspaceContext(this);
connectedCallback(): void {
super.connectedCallback();
@@ -68,7 +70,6 @@ export class UmbPropertySettingsModalElement extends UmbModalBaseElement<
});
this._originalPropertyData = this.value;
new UmbPropertyTypeWorkspaceContext(this, this.value.id);
const regEx = this.value.validation?.regEx ?? null;
if (regEx) {

View File

@@ -1,4 +1,4 @@
import { property, state } from '@umbraco-cms/backoffice/external/lit';
import { property } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
import { UmbModalContext } from '@umbraco-cms/backoffice/modal';
import type { ManifestModal, UmbModalExtensionElement } from '@umbraco-cms/backoffice/extension-registry';
@@ -37,7 +37,7 @@ export abstract class UmbModalBaseElement<
}
#modalContext?: UmbModalContext<ModalDataType, ModalValueType> | undefined;
@property({ type: Object, attribute: false })
@property({ attribute: false })
public get data(): ModalDataType | undefined {
return this._data;
}
@@ -46,7 +46,7 @@ export abstract class UmbModalBaseElement<
}
private _data?: ModalDataType | undefined;
@state()
@property({ attribute: false })
public get value(): ModalValueType {
return this.#value;
}