@@ -8,11 +8,13 @@ import {
88 computed ,
99 inject ,
1010 input ,
11+ inputBinding ,
1112 model ,
1213 OnChanges ,
1314 OnDestroy ,
1415 OnInit ,
1516 output ,
17+ outputBinding ,
1618 signal ,
1719 SimpleChanges ,
1820 Type ,
@@ -258,18 +260,19 @@ export class SiFlexibleDashboardComponent implements OnInit, OnChanges, OnDestro
258260 }
259261 this . viewState . set ( 'catalog' ) ;
260262 const componentType = this . widgetCatalogComponent ( ) ?? SiWidgetCatalogComponent ;
261- const catalogRef = this . catalogHost ( ) . createComponent < SiWidgetCatalogComponent > ( componentType ) ;
262- catalogRef . setInput ( 'searchPlaceholder' , this . searchPlaceholder ( ) ) ;
263- catalogRef . instance . widgetCatalog = this . widgetCatalog ( ) ;
264-
265- const subscription = catalogRef . instance . closed . subscribe ( widgetConfig => {
266- subscription . unsubscribe ( ) ;
267- this . viewState . set ( 'dashboard' ) ;
268- this . catalogHost ( ) . clear ( ) ;
269- if ( widgetConfig ) {
270- this . grid ( ) . addWidgetInstance ( widgetConfig ) ;
271- }
263+ const catalogRef = this . catalogHost ( ) . createComponent < SiWidgetCatalogComponent > ( componentType , {
264+ bindings : [
265+ inputBinding ( 'searchPlaceholder' , this . searchPlaceholder ) ,
266+ outputBinding < Omit < WidgetConfig , 'id' > | undefined > ( 'closed' , widgetConfig => {
267+ this . viewState . set ( 'dashboard' ) ;
268+ this . catalogHost ( ) . clear ( ) ;
269+ if ( widgetConfig ) {
270+ this . grid ( ) . addWidgetInstance ( widgetConfig ) ;
271+ }
272+ } )
273+ ]
272274 } ) ;
275+ catalogRef . instance . widgetCatalog = this . widgetCatalog ( ) ;
273276 }
274277
275278 protected onModified ( event : boolean ) : void {
@@ -321,17 +324,18 @@ export class SiFlexibleDashboardComponent implements OnInit, OnChanges, OnDestro
321324 widgetInstanceEditorDialogComponent ?? SiWidgetInstanceEditorDialogComponent ;
322325
323326 this . viewState . set ( 'editor' ) ;
324- const catalogRef =
325- this . catalogHost ( ) . createComponent < SiWidgetInstanceEditorDialogComponent > ( componentType ) ;
326- catalogRef . setInput ( 'widgetConfig' , widgetConfig ) ;
327- catalogRef . setInput ( 'widget' , widget ) ;
328- const subscription = catalogRef . instance . closed . subscribe ( editedWidgetConfig => {
329- subscription . unsubscribe ( ) ;
330- this . viewState . set ( 'dashboard' ) ;
331- this . catalogHost ( ) . clear ( ) ;
332- if ( editedWidgetConfig ) {
333- this . grid ( ) . updateWidgetInstance ( editedWidgetConfig ) ;
334- }
327+ this . catalogHost ( ) . createComponent < SiWidgetInstanceEditorDialogComponent > ( componentType , {
328+ bindings : [
329+ inputBinding ( 'widgetConfig' , ( ) => widgetConfig ) ,
330+ inputBinding ( 'widget' , ( ) => widget ) ,
331+ outputBinding < WidgetConfig | undefined > ( 'closed' , editedWidgetConfig => {
332+ this . viewState . set ( 'dashboard' ) ;
333+ this . catalogHost ( ) . clear ( ) ;
334+ if ( editedWidgetConfig ) {
335+ this . grid ( ) . updateWidgetInstance ( editedWidgetConfig ) ;
336+ }
337+ } )
338+ ]
335339 } ) ;
336340 }
337341
0 commit comments