@@ -27,6 +27,7 @@ import { CdcChildren } from '@openenergytools/scl-lib/dist/tDataTypeTemplates/ns
2727import { Snackbar } from './components/snackbar.js' ;
2828import { CreateDataObjectDialog } from './components/create-do-dialog.js' ;
2929import { DescriptionDialog } from './components/description-dialog.js' ;
30+ import { PreviewDialog } from './components/preview-dialog.js' ;
3031
3132import { cdClasses , lnClass74 } from './constants.js' ;
3233import { NodeData , getSelectionByPath , processEnums } from './foundation.js' ;
@@ -49,6 +50,7 @@ export default class TemplateGenerator extends ScopedElementsMixin(LitElement) {
4950 'oscd-snackbar' : Snackbar ,
5051 'create-data-object-dialog' : CreateDataObjectDialog ,
5152 'description-dialog' : DescriptionDialog ,
53+ 'preview-dialog' : PreviewDialog ,
5254 } ;
5355
5456 @property ( { attribute : false } )
@@ -66,6 +68,9 @@ export default class TemplateGenerator extends ScopedElementsMixin(LitElement) {
6668 @query ( 'description-dialog' )
6769 descriptionDialog ! : DescriptionDialog ;
6870
71+ @query ( 'preview-dialog' )
72+ previewDialog ! : PreviewDialog ;
73+
6974 @state ( )
7075 get selection ( ) : TreeSelection {
7176 if ( ! this . treeUI ) return { } ;
@@ -225,6 +230,11 @@ export default class TemplateGenerator extends ScopedElementsMixin(LitElement) {
225230 } , 0 ) ;
226231 }
227232
233+ private showPreview ( ) : void {
234+ this . previewDialog . selection = this . treeUI . selection ;
235+ this . previewDialog . show ( ) ;
236+ }
237+
228238 private updateSelectionAtPath (
229239 selection : TreeSelection ,
230240 path : string [ ] ,
@@ -298,12 +308,17 @@ export default class TemplateGenerator extends ScopedElementsMixin(LitElement) {
298308 <tree- grid @node-selected = ${ this . handleNodeSelected } > </ tree- grid>
299309 </ div>
300310 ${ this . doc
301- ? html `<md- fab
302- label= "${ this . addedLNode || 'Add Type' } "
303- @click = ${ ( ) => this . descriptionDialog . show ( ) }
304- >
305- <md- icon slot= "icon" > ${ this . addedLNode ? 'done' : 'add' } </ md- icon>
306- </ md- fab> `
311+ ? html `<div class= "fab-wrapper" >
312+ <md- fab @click = ${ ( ) => this . showPreview ( ) } title= "Preview" >
313+ <md- icon slot= "icon" > preview </ md- icon>
314+ </ md- fab>
315+ <md- fab
316+ label= "${ this . addedLNode || 'Add Type' } "
317+ @click = ${ ( ) => this . descriptionDialog . show ( ) }
318+ >
319+ <md- icon slot= "icon" > ${ this . addedLNode ? 'done' : 'add' } </ md- icon>
320+ </ md- fab>
321+ </ div> `
307322 : html `` }
308323 <create-data- object- dialog
309324 .cdClasses = ${ cdClasses }
@@ -314,6 +329,10 @@ export default class TemplateGenerator extends ScopedElementsMixin(LitElement) {
314329 .onConfirm = ${ ( description : string ) => this . saveTemplates ( description ) }
315330 .onCancel = ${ ( ) => this . descriptionDialog . close ( ) }
316331 > </ description- dialog>
332+ <preview- dialog
333+ .tree = ${ this . treeUI ?. tree }
334+ .lNodeType = ${ this . lNodeType }
335+ > </ preview- dialog>
317336 <oscd- snackbar
318337 .message = ${ this . snackbarMessage }
319338 .type = ${ this . snackbarType }
@@ -355,10 +374,12 @@ export default class TemplateGenerator extends ScopedElementsMixin(LitElement) {
355374 font-family : var (--oscd-theme-icon-font , 'Material Symbols Outlined' );
356375 }
357376
358- md- fab {
377+ . fab-wrapper {
359378 position : fixed;
360379 bottom : 32px ;
361380 right : 32px ;
381+ display : flex;
382+ gap : 16px ;
362383 }
363384
364385 .container {
0 commit comments