MaterialPopupComponent class
A popup component with material design look-and-feel.
Caveats:
- Popups closing and opening are automatically delayed to add animations
- Take advantage of enforceSpaceConstraints defined in PopupInterface.
This is useful if content size is such that adds scroll to the page.
- If the contents change and need to readjust position use trackLayoutChanges which is also defined in PopupInterface.
Material popup also supports deferred/lazy-loaded content.
This component publishes itself as a DropdownHandle, so its children may control its visibility by injecting it:
class MyComponent {
final DropdownHandle _dropdownHandle;
MyComponent(this._dropdownHandle);
void onSomethingThatShouldCloseTheDropdown() {
_dropdownHandle.close();
}
}
- Implemented types
- Mixed-in types
- Annotations
-
- @Component(selector: 'material-popup', providers: [ExistingProvider(DeferredContentAware, MaterialPopupComponent), ExistingProvider(DropdownHandle, MaterialPopupComponent), FactoryProvider(PopupHierarchy, getHierarchy), FactoryProvider(PopupRef, getResolvedPopupRef)], templateUrl: 'material_popup.html', styleUrls: ['material_popup.scss.css'], preserveWhitespace: true, visibility: Visibility.all, changeDetection: ChangeDetectionStrategy.onPush)
Constructors
-
MaterialPopupComponent(@Optional() @SkipSelf() PopupHierarchy? _hierarchy, @Optional() @SkipSelf() MaterialPopupComponent? parentPopup, @Attribute('role') String? role, NgZone _ngZone, OverlayService _overlayService, DomService _domService, ZIndexer _zIndexer, @Inject(defaultPopupPositions) List<
RelativePosition> _defaultPreferredPositions, @Inject(overlayRepositionLoop) Object useRepositionLoop, @Inject(overlayViewportBoundaries) Object viewportBoundaries, @Optional() PopupSizeProvider? _popupSizeProvider, ChangeDetectorRef _changeDetector, ViewContainerRef _viewContainer, Element elementRef)
Properties
- ariaLabel ↔ String?
-
The label to be used for assistive technologies.
getter/setter pair
- autoDismiss ↔ bool
-
Sets whether the popup should dismiss (close) itself on document press.
getter/setter pairinherited-setteroverride-getter
-
autoDismissBlockers
↔ List<
Element> -
The outer element which should prevent the auto dismiss logic.
getter/setter pairoverride-getter
- constrainToViewport ← bool
-
Sets whether the popup should be constrained to the viewport.
no getterinherited
- container → Element?
-
The html element corresponding to the popup.
no setteroverride
-
contentVisible
→ Stream<
bool> -
Component publishes to this stream to control the visibility of contents.
no setteroverride
- elementRef → Element
-
final
- enforceSpaceConstraints ← bool
-
Sets whether the popup should automatically reposition itself based on
space available relative to the viewport.
no getterinherited
- hasBox ↔ bool
-
Whether the popup panel has an enclosing box that wraps the content.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- hierarchy → PopupHierarchy
-
The popup visible hierarchy.
no setteroverride
- inkBackground ↔ bool
-
Sets the background color of the popup to be ink (
$mat-grey-700
).getter/setter pair - isVisible → bool
-
no setter
- matchMinSourceWidth ↔ bool
-
Sets whether popup should set a minimum width to the width of source.
getter/setter pairoverride-setter
- maxHeight ↔ num?
-
The max height of the popup content provided by the PopupSizeProvider.
getter/setter pair
- maxWidth ↔ num?
-
The max width of the popup content provided by the PopupSizeProvider.
getter/setter pair
- minHeight ↔ num?
-
The min height of the popup content provided by the PopupSizeProvider.
getter/setter pair
- minWidth ↔ num?
-
The min width of the popup content provided by the PopupSizeProvider.
getter/setter pair
- offsetX ← int
-
Sets the x-offset to where the popup will be positioned ultimately.
no getterinherited
- offsetY ← int
-
Sets the y-offset to where the popup will be positioned ultimately.
no getterinherited
-
onAutoDismissed
→ Stream<
Event> -
Stream on which an event is fired when the popup is auto dismissed.
Output event should be either a FocusEvent or a MouseEvent.
no setter
-
onClose
→ Stream<
void> -
no setterinherited
-
onCloseController
→ StreamController<
void> -
finalinherited
-
onOpen
→ Stream<
void> -
no setterinherited
-
onOpenController
→ StreamController<
void> -
finalinherited
-
onOpened
→ Stream<
void> -
Stream on which an event is fired after the popup has finished opening.
no setter
-
onVisible
→ Stream<
bool> -
no setterinherited
-
onVisibleController
→ StreamController<
bool> -
finalinherited
- paneId → String?
-
The popup pane ID, which is added to the DOM (as pane-id) for testing.
no setter
- popupSizeProvider ← PopupSizeProvider
-
Sets a provider for the popup size.
no getter
-
preferredPositions
← Iterable<
RelativePosition> -
Sets what positions should be tried when enforceSpaceConstraints is set.
no getterinherited
- role → String
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showPopup ↔ bool
-
Whether the underlying popup should be content visible.
getter/setter pair
- slide ↔ String?
-
Direction of popup scaling.
getter/setter pair
- source ← PopupSource?
-
Sets the source the popup should be created relative to.
no getteroverride
- state → PopupState
-
The state of the PopupRef that is manipulated by this component.
final
- templateRef ↔ TemplateRef?
-
getter/setter pair
- trackLayoutChanges ← bool
-
Sets whether the source should be tracked for changes.
no getterinherited
- transformOrigin → String?
-
The CSS transform origin based on configuration.
no setter
- uniqueId → String
-
The unique DOM ID assigned to the popup element.
no setter
- visible ← bool
-
Sets whether the popup should be shown.
no getteroverride
- z ↔ int
-
The z-elevation of the border effect.
getter/setter pair
- zElevation → String
-
no setter
- zIndex → String
-
no setter
Methods
-
attachToVisibleHierarchy(
) → void -
Attach this element to the hierarchy.
inherited
-
close(
) → void -
override
-
detachFromVisibleHierarchy(
) → void -
inherited
-
ngAfterViewInit(
) → void -
ngOnDestroy(
) → void - Executed before the directive is removed from the DOM and destroyed.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onAutoDismiss(
Event event) → void -
override
-
onDismiss(
) → void -
override
-
open(
) → void -
override
-
toggle(
) → void -
Toggles the visibility of the popup
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- SLIDE_DELAY → const Duration