From d67f71b7ffcef5df086d355a52f1c38535d6cc62 Mon Sep 17 00:00:00 2001
From: Lone Iversen <108085781+loivsen@users.noreply.github.com>
Date: Tue, 23 Jan 2024 15:36:58 +0100
Subject: [PATCH] delete event possibility
---
...editor-ui-block-grid-type-configuration.element.ts | 11 +++++++++--
.../src/packages/block/block-type/components/index.ts | 2 +-
.../input-block-type/input-block-type.element.ts | 3 ++-
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/property-editors/block-grid-type-configuration/property-editor-ui-block-grid-type-configuration.element.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/property-editors/block-grid-type-configuration/property-editor-ui-block-grid-type-configuration.element.ts
index 354518ad8d..5a6c73b111 100644
--- a/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/property-editors/block-grid-type-configuration/property-editor-ui-block-grid-type-configuration.element.ts
+++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/property-editors/block-grid-type-configuration/property-editor-ui-block-grid-type-configuration.element.ts
@@ -68,6 +68,7 @@ export class UmbPropertyEditorUIBlockGridTypeConfigurationElement
this._mappedValuesAndGroups = [{ blocks: valuesWithNoGroup }, ...valuesWithGroup];
}
+ /*
#onChange(e: CustomEvent, group?: UmbBlockGridGroupTypeConfiguration) {
const groupValues = (e.target as UmbInputBlockTypeElement).value;
const newValues = groupValues.map((value) => ({ ...value, groupKey: group?.key }));
@@ -75,6 +76,12 @@ export class UmbPropertyEditorUIBlockGridTypeConfigurationElement
this.value = [...filteredValues, ...newValues];
this.dispatchEvent(new CustomEvent('property-value-change'));
}
+ */
+
+ #deleteItem(e: CustomEvent) {
+ this.value = this._value.filter((block) => block.contentElementTypeKey !== e.detail.contentElementTypeKey);
+ this.dispatchEvent(new CustomEvent('property-value-change'));
+ }
render() {
return html`${repeat(
@@ -85,7 +92,7 @@ export class UmbPropertyEditorUIBlockGridTypeConfigurationElement
this.#onChange(e, group)}>`,
+ @delete=${this.#deleteItem}>`,
)}`;
}
@@ -112,7 +119,7 @@ export class UmbPropertyEditorUIBlockGridTypeConfigurationElement
auto-width
label="Group"
.value=${groupName ?? ''}
- @change=${(e: UUIInputEvent) => this.#changeGroupName(e, groupKey)}>
+ @delete=${(e: UUIInputEvent) => this.#changeGroupName(e, groupKey)}>
this.#deleteGroup(groupKey)}>
diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-type/components/index.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-type/components/index.ts
index fcdafe77a5..2ce6e9bff7 100644
--- a/src/Umbraco.Web.UI.Client/src/packages/block/block-type/components/index.ts
+++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-type/components/index.ts
@@ -1,2 +1,2 @@
-export * from './input-block-type/index.js';
export * from './block-type-card/index.js';
+export * from './input-block-type/index.js';
diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-type/components/input-block-type/input-block-type.element.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-type/components/input-block-type/input-block-type.element.ts
index 2a3721f41a..2dc6c57e31 100644
--- a/src/Umbraco.Web.UI.Client/src/packages/block/block-type/components/input-block-type/input-block-type.element.ts
+++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-type/components/input-block-type/input-block-type.element.ts
@@ -101,7 +101,8 @@ export class UmbInputBlockTypeElement<
deleteItem(contentElementTypeKey: string) {
this.value = this._items.filter((x) => x.contentElementTypeKey !== contentElementTypeKey);
- this.dispatchEvent(new UmbChangeEvent());
+ this.dispatchEvent(new CustomEvent('delete', { detail: { contentElementTypeKey } }));
+ //this.dispatchEvent(new UmbChangeEvent());
}
protected getFormElement() {