From 2798ac3b2d2bdb38026933f1ad69b1aaae3961ac Mon Sep 17 00:00:00 2001 From: leekelleher Date: Thu, 11 Jan 2024 15:32:28 +0000 Subject: [PATCH] TreePickerSourceType: fixed bug with re-initializing the value The `UmbPropertyValueChangeEvent` had to be triggered. --- ...r-ui-tree-picker-source-type-picker.element.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/tree-picker/config/source-type-picker/property-editor-ui-tree-picker-source-type-picker.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/tree-picker/config/source-type-picker/property-editor-ui-tree-picker-source-type-picker.element.ts index 16b11ffa40..90176aa18f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/tree-picker/config/source-type-picker/property-editor-ui-tree-picker-source-type-picker.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/tree-picker/config/source-type-picker/property-editor-ui-tree-picker-source-type-picker.element.ts @@ -7,12 +7,16 @@ import { customElement, html, property, state } from '@umbraco-cms/backoffice/ex import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import { UMB_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/property'; +import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; /** * @element umb-property-editor-ui-tree-picker-source-type-picker */ @customElement('umb-property-editor-ui-tree-picker-source-type-picker') -export class UmbPropertyEditorUITreePickerSourceTypePickerElement extends UmbLitElement implements UmbPropertyEditorUiElement { +export class UmbPropertyEditorUITreePickerSourceTypePickerElement + extends UmbLitElement + implements UmbPropertyEditorUiElement +{ #datasetContext?: typeof UMB_PROPERTY_DATASET_CONTEXT.TYPE; @property({ type: Array }) @@ -42,7 +46,7 @@ export class UmbPropertyEditorUITreePickerSourceTypePickerElement extends UmbLit // If we had a sourceType before, we can see this as a change and not the initial value, // so let's reset the value, so we don't carry over content-types to the new source type. if (this.#initialized && this.sourceType !== startNode.type) { - this.value = []; + this.#setValue([]); } this.sourceType = startNode.type; @@ -65,13 +69,16 @@ export class UmbPropertyEditorUITreePickerSourceTypePickerElement extends UmbLit this.value = (event.target).selectedIds; break; case 'member': - this.value = (event.target).selectedIds; + this.#setValue((event.target).selectedIds); break; default: break; } + } - this.dispatchEvent(new CustomEvent('property-value-change')); + #setValue(value: string[]) { + this.value = value; + this.dispatchEvent(new UmbPropertyValueChangeEvent()); } render() {