From 1c963a8d9ecb49991d68952693ca793645dae46a Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 21 Sep 2022 09:39:25 +0200 Subject: [PATCH] reset property editor UI when new property editor is selected --- .../edit/editor-view-data-type-edit.element.ts | 13 +++++++------ .../src/mocks/data/data-type.data.ts | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/editors/data-type/views/edit/editor-view-data-type-edit.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/editors/data-type/views/edit/editor-view-data-type-edit.element.ts index 323b9af5ef..26a0f111e0 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/editors/data-type/views/edit/editor-view-data-type-edit.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/editors/data-type/views/edit/editor-view-data-type-edit.element.ts @@ -96,7 +96,7 @@ export class UmbEditorViewDataTypeEditElement extends UmbContextConsumerMixin(Li }); } - private _observePropertyEditor(propertyEditorAlias: string) { + private _observePropertyEditor(propertyEditorAlias: string | null) { if (!propertyEditorAlias) return; this._propertyEditorSubscription?.unsubscribe(); @@ -110,7 +110,7 @@ export class UmbEditorViewDataTypeEditElement extends UmbContextConsumerMixin(Li }); } - private _observeAvailablePropertyEditorUIs(propertyEditorAlias: string) { + private _observeAvailablePropertyEditorUIs(propertyEditorAlias: string | null) { if (!propertyEditorAlias) return; this._availablePropertyEditorUIsSubscription?.unsubscribe(); @@ -133,7 +133,7 @@ export class UmbEditorViewDataTypeEditElement extends UmbContextConsumerMixin(Li }); } - private _observePropertyEditorUI(propertyEditorUIAlias: string) { + private _observePropertyEditorUI(propertyEditorUIAlias: string | null) { if (!propertyEditorUIAlias) return; this._propertyEditorUISubscription?.unsubscribe(); @@ -150,7 +150,7 @@ export class UmbEditorViewDataTypeEditElement extends UmbContextConsumerMixin(Li private _openPropertyEditorPicker() { if (!this._dataType) return; - const selection = [this._dataType.propertyEditorAlias] || []; + const selection = this._dataType.propertyEditorAlias ? [this._dataType.propertyEditorAlias] : []; const modalHandler = this._modalService?.propertyEditorPicker({ selection }); modalHandler?.onClose().then(({ selection } = {}) => { @@ -164,6 +164,7 @@ export class UmbEditorViewDataTypeEditElement extends UmbContextConsumerMixin(Li private _selectPropertyEditor(propertyEditorAlias: string) { if (!this._dataType || this._dataType.propertyEditorUIAlias === propertyEditorAlias) return; + this._selectPropertyEditorUI(null); this._dataType.propertyEditorAlias = propertyEditorAlias; this._dataTypeContext?.update({ propertyEditorAlias }); } @@ -171,7 +172,7 @@ export class UmbEditorViewDataTypeEditElement extends UmbContextConsumerMixin(Li private _openPropertyEditorUIPicker() { if (!this._dataType) return; - const selection = [this._dataType.propertyEditorUIAlias] || []; + const selection = this._dataType.propertyEditorUIAlias ? [this._dataType.propertyEditorUIAlias] : []; const modalHandler = this._modalService?.propertyEditorUIPicker({ selection }); modalHandler?.onClose().then(({ selection } = {}) => { @@ -182,7 +183,7 @@ export class UmbEditorViewDataTypeEditElement extends UmbContextConsumerMixin(Li }); } - private _selectPropertyEditorUI(propertyEditorUIAlias: string) { + private _selectPropertyEditorUI(propertyEditorUIAlias: string | null) { if (!this._dataType || this._dataType.propertyEditorUIAlias === propertyEditorUIAlias) return; this._dataType.propertyEditorUIAlias = propertyEditorUIAlias; diff --git a/src/Umbraco.Web.UI.Client/src/mocks/data/data-type.data.ts b/src/Umbraco.Web.UI.Client/src/mocks/data/data-type.data.ts index f4600c540e..4bc914d1c6 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/data/data-type.data.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/data/data-type.data.ts @@ -2,8 +2,8 @@ import { Entity } from './entities'; import { UmbEntityData } from './entity.data'; export interface DataTypeEntity extends Entity { - propertyEditorAlias: string; - propertyEditorUIAlias: string; + propertyEditorAlias: string | null; + propertyEditorUIAlias: string | null; //configUI: any; // this is the prevalues... }