From e75d9a87500d9c43eef88b610f0ee8f2784ccd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20I=C3=9Fbr=C3=BCcker?= Date: Wed, 11 Dec 2024 12:21:31 +0100 Subject: [PATCH 1/2] fix: add missing section type to dashboard events --- packages/dashboard/src/vaadin-dashboard.d.ts | 8 ++++---- .../dashboard/test/typings/dashboard.types.ts | 15 ++++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/dashboard/src/vaadin-dashboard.d.ts b/packages/dashboard/src/vaadin-dashboard.d.ts index 59f74d331e..4b8cd6a090 100644 --- a/packages/dashboard/src/vaadin-dashboard.d.ts +++ b/packages/dashboard/src/vaadin-dashboard.d.ts @@ -68,7 +68,7 @@ export type DashboardRenderer = ( * Fired when an item was moved */ export type DashboardItemMovedEvent = CustomEvent<{ - item: TItem; + item: TItem | DashboardSectionItem; items: Array>; @@ -97,7 +97,7 @@ export type DashboardItemRemovedEvent = CustomEvent * Fired when an item selected state changed */ export type DashboardItemSelectedChangedEvent = CustomEvent<{ - item: TItem; + item: TItem | DashboardSectionItem; value: boolean; }>; @@ -105,7 +105,7 @@ export type DashboardItemSelectedChangedEvent = Cus * Fired when an item move mode changed */ export type DashboardItemMoveModeChangedEvent = CustomEvent<{ - item: TItem; + item: TItem | DashboardSectionItem; value: boolean; }>; @@ -113,7 +113,7 @@ export type DashboardItemMoveModeChangedEvent = Cus * Fired when an item resize mode changed */ export type DashboardItemResizeModeChangedEvent = CustomEvent<{ - item: TItem; + item: TItem | DashboardSectionItem; value: boolean; }>; diff --git a/packages/dashboard/test/typings/dashboard.types.ts b/packages/dashboard/test/typings/dashboard.types.ts index 532471ec5c..d0c9c2d836 100644 --- a/packages/dashboard/test/typings/dashboard.types.ts +++ b/packages/dashboard/test/typings/dashboard.types.ts @@ -75,7 +75,8 @@ assertType>>(s narrowedDashboard.addEventListener('dashboard-item-moved', (event) => { assertType>(event); - assertType(event.detail.item); + assertType(event.detail.item as TestDashboardItem); + assertType>(event.detail.item as DashboardSectionItem); assertType>>(event.detail.items); assertType | undefined>(event.detail.section); }); @@ -88,25 +89,29 @@ narrowedDashboard.addEventListener('dashboard-item-resized', (event) => { narrowedDashboard.addEventListener('dashboard-item-removed', (event) => { assertType>(event); - assertType>(event.detail.item); + assertType(event.detail.item as TestDashboardItem); + assertType>(event.detail.item as DashboardSectionItem); assertType>>(event.detail.items); }); narrowedDashboard.addEventListener('dashboard-item-selected-changed', (event) => { assertType>(event); - assertType(event.detail.item); + assertType(event.detail.item as TestDashboardItem); + assertType>(event.detail.item as DashboardSectionItem); assertType(event.detail.value); }); narrowedDashboard.addEventListener('dashboard-item-move-mode-changed', (event) => { assertType>(event); - assertType(event.detail.item); + assertType(event.detail.item as TestDashboardItem); + assertType>(event.detail.item as DashboardSectionItem); assertType(event.detail.value); }); narrowedDashboard.addEventListener('dashboard-item-resize-mode-changed', (event) => { assertType>(event); - assertType(event.detail.item); + assertType(event.detail.item as TestDashboardItem); + assertType>(event.detail.item as DashboardSectionItem); assertType(event.detail.value); }); From 4d4133294ea8e330257fab5094c6763e01fc2321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20I=C3=9Fbr=C3=BCcker?= Date: Wed, 11 Dec 2024 12:34:09 +0100 Subject: [PATCH 2/2] revert type for resize move changed event --- packages/dashboard/src/vaadin-dashboard.d.ts | 2 +- packages/dashboard/test/typings/dashboard.types.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/dashboard/src/vaadin-dashboard.d.ts b/packages/dashboard/src/vaadin-dashboard.d.ts index 4b8cd6a090..b4158f9cea 100644 --- a/packages/dashboard/src/vaadin-dashboard.d.ts +++ b/packages/dashboard/src/vaadin-dashboard.d.ts @@ -113,7 +113,7 @@ export type DashboardItemMoveModeChangedEvent = Cus * Fired when an item resize mode changed */ export type DashboardItemResizeModeChangedEvent = CustomEvent<{ - item: TItem | DashboardSectionItem; + item: TItem; value: boolean; }>; diff --git a/packages/dashboard/test/typings/dashboard.types.ts b/packages/dashboard/test/typings/dashboard.types.ts index d0c9c2d836..ea7621a7ce 100644 --- a/packages/dashboard/test/typings/dashboard.types.ts +++ b/packages/dashboard/test/typings/dashboard.types.ts @@ -110,8 +110,7 @@ narrowedDashboard.addEventListener('dashboard-item-move-mode-changed', (event) = narrowedDashboard.addEventListener('dashboard-item-resize-mode-changed', (event) => { assertType>(event); - assertType(event.detail.item as TestDashboardItem); - assertType>(event.detail.item as DashboardSectionItem); + assertType(event.detail.item); assertType(event.detail.value); });