File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,14 @@ export class OverlayRef implements PortalHost {
172
172
if ( this . _state . minHeight || this . _state . minHeight === 0 ) {
173
173
this . _pane . style . minHeight = formatCssUnit ( this . _state . minHeight ) ;
174
174
}
175
+
176
+ if ( this . _state . maxWidth || this . _state . maxWidth === 0 ) {
177
+ this . _pane . style . maxWidth = formatCssUnit ( this . _state . maxWidth ) ;
178
+ }
179
+
180
+ if ( this . _state . maxHeight || this . _state . maxHeight === 0 ) {
181
+ this . _pane . style . maxHeight = formatCssUnit ( this . _state . maxHeight ) ;
182
+ }
175
183
}
176
184
177
185
/** Toggles the pointer events for the overlay pane element. */
Original file line number Diff line number Diff line change @@ -44,6 +44,12 @@ export class OverlayState {
44
44
/** The min-height of the overlay panel. If a number is provided, pixel units are assumed. */
45
45
minHeight ?: number | string ;
46
46
47
+ /** The max-width of the overlay panel. If a number is provided, pixel units are assumed. */
48
+ maxWidth ?: number | string ;
49
+
50
+ /** The max-height of the overlay panel. If a number is provided, pixel units are assumed. */
51
+ maxHeight ?: number | string ;
52
+
47
53
/** The direction of the text in the overlay panel. */
48
54
direction ?: Direction = 'ltr' ;
49
55
Original file line number Diff line number Diff line change @@ -295,6 +295,22 @@ describe('Overlay', () => {
295
295
expect ( pane . style . minHeight ) . toEqual ( '500px' ) ;
296
296
} ) ;
297
297
298
+ it ( 'should apply the max width set in the config' , ( ) => {
299
+ state . maxWidth = 200 ;
300
+
301
+ overlay . create ( state ) . attach ( componentPortal ) ;
302
+ const pane = overlayContainerElement . children [ 0 ] as HTMLElement ;
303
+ expect ( pane . style . maxWidth ) . toEqual ( '200px' ) ;
304
+ } ) ;
305
+
306
+
307
+ it ( 'should apply the max height set in the config' , ( ) => {
308
+ state . maxHeight = 500 ;
309
+
310
+ overlay . create ( state ) . attach ( componentPortal ) ;
311
+ const pane = overlayContainerElement . children [ 0 ] as HTMLElement ;
312
+ expect ( pane . style . maxHeight ) . toEqual ( '500px' ) ;
313
+ } ) ;
298
314
299
315
it ( 'should support zero widths and heights' , ( ) => {
300
316
state . width = 0 ;
@@ -305,7 +321,6 @@ describe('Overlay', () => {
305
321
expect ( pane . style . width ) . toEqual ( '0px' ) ;
306
322
expect ( pane . style . height ) . toEqual ( '0px' ) ;
307
323
} ) ;
308
-
309
324
} ) ;
310
325
311
326
describe ( 'backdrop' , ( ) => {
You can’t perform that action at this time.
0 commit comments