@@ -63,7 +63,7 @@ export default class IgcTileComponent extends EventEmitterMixin<
6363 private _dragController : TileDragAndDropController ;
6464 private _position = - 1 ;
6565 private _disableDrag = false ;
66-
66+ private _fullscreen = false ;
6767 private _context = new ContextProvider ( this , {
6868 context : tileContext ,
6969 initialValue : this ,
@@ -75,9 +75,6 @@ export default class IgcTileComponent extends EventEmitterMixin<
7575 @state ( )
7676 private _hasDragOver = false ;
7777
78- @state ( )
79- private _isFullscreen = false ;
80-
8178 /**
8279 * The unique identifier of the tile.
8380 * @attr
@@ -97,6 +94,19 @@ export default class IgcTileComponent extends EventEmitterMixin<
9794 @property ( { type : Number } )
9895 public rowStart : number | null = null ;
9996
97+ @property ( { type : Boolean , reflect : true } )
98+ public set fullscreen ( value : boolean ) {
99+ if ( this . _fullscreen === value ) return ;
100+
101+ this . _fullscreen = value ;
102+ this . _context . setValue ( this , true ) ;
103+ this . handleFullscreenRequest ( ) ;
104+ }
105+
106+ public get fullscreen ( ) {
107+ return this . _fullscreen ;
108+ }
109+
100110 /**
101111 * Indicates whether the tile occupies all available space within the layout.
102112 * @attr
@@ -143,7 +153,6 @@ export default class IgcTileComponent extends EventEmitterMixin<
143153
144154 @watch ( 'maximized' )
145155 protected maximizedChanged ( ) {
146- //TODO: When the header UI is implemented, emit the event on header button/icon click.
147156 if ( this . _emitMaximizedEvent && ! this . emitMaximizedEvent ( ) ) {
148157 this . maximized = ! this . maximized ;
149158 return ;
@@ -194,14 +203,20 @@ export default class IgcTileComponent extends EventEmitterMixin<
194203
195204 // Will probably expose that as a dynamic binding based on a property
196205 // and as a response to some UI element interaction
197- this . addEventListener ( 'dblclick' , this . handleFullscreenRequest ) ;
206+ // REVIEW: fullscreen property and a tile header action button added
207+ this . addEventListener ( 'dblclick' , this . handleDoubleClick ) ;
198208 }
199209
200210 public override connectedCallback ( ) {
201211 super . connectedCallback ( ) ;
202212 this . tileId = this . tileId || `tile-${ IgcTileComponent . increment ( ) } ` ;
203213 }
204214
215+ public toggleFullscreen ( ) {
216+ this . fullscreen = ! this . fullscreen ;
217+ this . emitFullScreenEvent ( ) ;
218+ }
219+
205220 public toggleMaximize ( ) {
206221 this . _emitMaximizedEvent = true ;
207222 this . maximized = ! this . maximized ;
@@ -214,7 +229,7 @@ export default class IgcTileComponent extends EventEmitterMixin<
214229
215230 private emitFullScreenEvent ( ) {
216231 return this . emitEvent ( 'igcTileFullscreen' , {
217- detail : { tile : this , state : this . _isFullscreen } ,
232+ detail : { tile : this , state : this . fullscreen } ,
218233 cancelable : true ,
219234 } ) ;
220235 }
@@ -226,19 +241,21 @@ export default class IgcTileComponent extends EventEmitterMixin<
226241 } ) ;
227242 }
228243
244+ private handleDoubleClick ( ) {
245+ if ( ! this . emitFullScreenEvent ( ) ) {
246+ return ;
247+ }
248+
249+ this . fullscreen = ! this . fullscreen ;
250+ }
251+
229252 private async handleFullscreenRequest ( ) {
230253 try {
231- if ( ! this . emitFullScreenEvent ( ) ) {
232- return ;
233- }
234-
235- if ( ! this . _isFullscreen ) {
254+ if ( this . fullscreen ) {
236255 await this . requestFullscreen ( ) ;
237256 } else {
238257 await document . exitFullscreen ( ) ;
239258 }
240-
241- this . _isFullscreen = ! this . _isFullscreen ;
242259 } catch {
243260 document . exitFullscreen ( ) ;
244261 }
@@ -331,7 +348,7 @@ export default class IgcTileComponent extends EventEmitterMixin<
331348 const parts = partNameMap ( {
332349 base : true ,
333350 'drag-over' : this . _hasDragOver ,
334- fullscreen : this . _isFullscreen ,
351+ fullscreen : this . fullscreen ,
335352 draggable : ! this . disableDrag ,
336353 dragging : this . _isDragging ,
337354 } ) ;
@@ -348,7 +365,7 @@ export default class IgcTileComponent extends EventEmitterMixin<
348365
349366 protected override render ( ) {
350367 const renderResize =
351- this . disableResize || this . maximized || this . _isFullscreen ;
368+ this . disableResize || this . maximized || this . fullscreen ;
352369
353370 return renderResize
354371 ? this . renderContent ( )
0 commit comments