Skip to content

Commit de6c206

Browse files
naaajiicrisbeto
authored andcommittedNov 11, 2024·
fix(material/bottom-sheet): add height minHeight maxHeight to config (#29794)
these properties were missing from the config but still worked as they were passed to dialog under the hood to avoid type errors fixes #28832 (cherry picked from commit d4adbaa)
1 parent b57f7b6 commit de6c206

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
 

Diff for: ‎src/material/bottom-sheet/bottom-sheet-config.ts

+9
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,13 @@ export class MatBottomSheetConfig<D = any> {
7272

7373
/** Scroll strategy to be used for the bottom sheet. */
7474
scrollStrategy?: ScrollStrategy;
75+
76+
/** Height for the bottom sheet. */
77+
height?: string = '';
78+
79+
/** Minimum height for the bottom sheet. If a number is provided, assumes pixel units. */
80+
minHeight?: number | string;
81+
82+
/** Maximum height for the bottom sheet. If a number is provided, assumes pixel units. */
83+
maxHeight?: number | string;
7584
}

Diff for: ‎src/material/bottom-sheet/bottom-sheet.spec.ts

+18
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,24 @@ describe('MatBottomSheet', () => {
461461
expect(scrollStrategy.enable).toHaveBeenCalled();
462462
});
463463

464+
it('should contain the height style properties on overlay pane', () => {
465+
bottomSheet.open(PizzaMsg, {
466+
panelClass: 'height--pane',
467+
height: '300px',
468+
maxHeight: 400, // this is converted into pixels
469+
minHeight: 200, // this is converted into pixels
470+
});
471+
472+
viewContainerFixture.detectChanges();
473+
474+
const paneElement = overlayContainerElement.querySelector('.height--pane') as HTMLElement;
475+
476+
expect(paneElement).toBeTruthy();
477+
expect(paneElement.style.height).toBe('300px');
478+
expect(paneElement.style.maxHeight).toBe('400px');
479+
expect(paneElement.style.minHeight).toBe('200px');
480+
});
481+
464482
describe('passing in data', () => {
465483
it('should be able to pass in data', () => {
466484
const config = {

Diff for: ‎tools/public_api_guard/material/bottom-sheet.md

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export class MatBottomSheetConfig<D = any> {
6464
direction?: Direction;
6565
disableClose?: boolean;
6666
hasBackdrop?: boolean;
67+
height?: string;
68+
maxHeight?: number | string;
69+
minHeight?: number | string;
6770
panelClass?: string | string[];
6871
restoreFocus?: boolean;
6972
scrollStrategy?: ScrollStrategy;

0 commit comments

Comments
 (0)
Please sign in to comment.