MCPcopy Create free account
hub / github.com/angular/components / MatDrawerContainer

Class MatDrawerContainer

src/material/sidenav/drawer.ts:733–1101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

731 imports: [MatDrawerContent],
732})
733export class MatDrawerContainer implements AfterContentInit, DoCheck, OnDestroy {
734 private _dir = inject(Directionality, {optional: true});
735 private _element = inject<ElementRef<HTMLElement>>(ElementRef);
736 private _ngZone = inject(NgZone);
737 private _changeDetectorRef = inject(ChangeDetectorRef);
738 private _animationDisabled = _animationsDisabled();
739 _transitionsEnabled = false;
740
741 /** All drawers in the container. Includes drawers from inside nested containers. */
742 @ContentChildren(MatDrawer, {
743 // We need to use `descendants: true`, because Ivy will no longer match
744 // indirect descendants if it's left as false.
745 descendants: true,
746 })
747 _allDrawers!: QueryList<MatDrawer>;
748
749 /** Drawers that belong to this container. */
750 _drawers = new QueryList<MatDrawer>();
751
752 @ContentChild(MatDrawerContent) _content!: MatDrawerContent;
753 @ViewChild(MatDrawerContent) _userContent!: MatDrawerContent;
754
755 /** The drawer child with the `start` position. */
756 get start(): MatDrawer | null {
757 return this._start;
758 }
759
760 /** The drawer child with the `end` position. */
761 get end(): MatDrawer | null {
762 return this._end;
763 }
764
765 /**
766 * Whether to automatically resize the container whenever
767 * the size of any of its drawers changes.
768 *
769 * **Use at your own risk!** Enabling this option can cause layout thrashing by measuring
770 * the drawers on every change detection cycle. Can be configured globally via the
771 * `MAT_DRAWER_DEFAULT_AUTOSIZE` token.
772 */
773 @Input()
774 get autosize(): boolean {
775 return this._autosize;
776 }
777 set autosize(value: BooleanInput) {
778 this._autosize = coerceBooleanProperty(value);
779 }
780 private _autosize = inject(MAT_DRAWER_DEFAULT_AUTOSIZE);
781
782 /**
783 * Whether the drawer container should have a backdrop while one of the sidenavs is open.
784 * If explicitly set to `true`, the backdrop will be enabled for drawers in the `side`
785 * mode as well.
786 */
787 @Input()
788 get hasBackdrop(): boolean {
789 return this._drawerHasBackdrop(this._start) || this._drawerHasBackdrop(this._end);
790 }

Callers

nothing calls this directly

Calls 1

_animationsDisabledFunction · 0.90

Tested by

no test coverage detected