MaterialDropdownSelectComponent<T> class
See material_dropdown_select.md for an overview of the component. See examples for usage.
Attributes:
buttonAriaRole
-- Aria label for the button icon.popupClass
-- Class to be added to the dropdown popup so that the popup can be styled in an encapsulated way. SeeMaterialPopup
for documentation.
- Inheritance
-
- Object
- SelectionContainer<
T> - MaterialSelectBase<
T> - MaterialDropdownSelectComponent
- Implemented types
- Mixed-in types
- Annotations
-
- @Component(selector: 'material-dropdown-select', providers: [ExistingProvider(DropdownHandle, MaterialDropdownSelectComponent), ExistingProvider(HasDisabled, MaterialDropdownSelectComponent), ExistingProvider(HasRenderer, MaterialDropdownSelectComponent), ExistingProvider(DeferredContentAware, MaterialDropdownSelectComponent), ExistingProvider(SelectionContainer, MaterialDropdownSelectComponent), ExistingProvider(PopupSizeProvider, MaterialDropdownSelectComponent), ExistingProvider(ActivationHandler, MaterialDropdownSelectComponent)], directives: [ActiveItemDirective, AutoFocusDirective, DeferredContentDirective, DropdownButtonComponent, DynamicComponent, KeyboardOnlyFocusIndicatorDirective, MaterialListComponent, MaterialPopupComponent, MaterialSelectDropdownItemComponent, NgFor, NgIf, PopupSourceDirective], directiveTypes: [Typed<MaterialSelectDropdownItemComponent<String>>(on: 'deselectItem'), Typed<MaterialSelectDropdownItemComponent<String>>(on: 'emptyGroupLabel'), Typed<MaterialSelectDropdownItemComponent>.of([#T])], viewProviders: [FactoryProvider<ActiveItemModel>(ActiveItemModel, fromDropdown, deps: [MaterialDropdownSelectComponent])], templateUrl: 'material_dropdown_select.html', styleUrls: ['material_dropdown_select.scss.css'], visibility: Visibility.all, changeDetection: ChangeDetectionStrategy.onPush)
Constructors
- MaterialDropdownSelectComponent(@Optional() IdGenerator? idGenerator, @Optional() @SkipSelf() PopupSizeProvider? _popupSizeDelegate, @Optional() @Inject(rtlToken) bool? rtl, @Attribute('popupClass') String? popupClass, @Attribute('buttonAriaRole') String? buttonAriaRole, ChangeDetectorRef _changeDetector, HtmlElement element)
Properties
- activateFirstOption ↔ bool
-
Whether to activate (visually focus but not select) the first available
option when the dropdown opens.
getter/setter pair
- activeModel → ActiveItemModel
-
Keeps track of the active item.
final
- ariaActiveDescendant ↔ String
-
The id of the active element of the dropdown.
getter/setter pair
- autoDismiss ↔ bool?
-
Whether the popup should close when the document pressed.
getter/setter pairinherited
-
blur
→ Stream<
FocusEvent> -
Event that fires when the dropdown button is blurred.
no setter
-
One or more space-delimited ids of elements that provide additional
description for the dropdown select.
getter/setter pair
-
Aria label for the button.
getter/setter pairinherited
-
The id of an element that describes the selection in the dropdown button.
getter/setter pair
-
The ARIA role to be used for the internal dropdown button.
final
-
no setterinherited
-
Text on the button.
getter/setter pairinherited
- constrainToViewport ↔ bool
-
Whether to clamp the dropdown position so that it never goes offscreen.
getter/setter pairinherited
-
contentVisible
→ Stream<
bool> -
Component publishes to this stream to control the visibility of contents.
no setterinherited
- deselectLabel ↔ String?
-
Text label for select item that deselects the current selection.
getter/setter pair
- deselectOnActivate ↔ bool
-
Whether to deselect a selected option on click or enter/space key.
getter/setter pair
- disabled ↔ bool
-
Whether the button is disabled.
getter/setter pairinherited-getteroverride-setter
- dropdownButton ↔ DropdownButtonComponent?
-
getter/setter pair
- enforceSpaceConstraints ↔ bool
-
Avoid rendering drop down offscreen.
getter/setter pairinherited
- error ↔ String?
-
An error displayed below the dropdown button.
getter/setter pair
-
factoryRenderer
↔ FactoryRenderer<
RendersValue, T> ? -
Specifies the componentRenderer to use to determine the component for
rendering an item.
Specifies the factoryRenderer to use to determine the factory for
rendering an item.
getter/setter pairinherited-getteroverride-setter
-
focus
→ Stream<
FocusEvent> -
Event that fires when the dropdown button is focused.
no setter
- hasCustomLabelRenderer → bool
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon ↔ Icon?
-
Icon to be used with the button. (Optional)
getter/setter pairinherited
- iconName ↔ String?
-
Icon to use for the button.
getter/setter pairinherited
- isDeselectItemSelected → bool
-
no setter
- isMultiSelect → bool
-
no setterinherited
- isRtl ↔ bool?
-
Whether the direction of the component is RTL.
getter/setter pairinherited
- isSingleSelect → bool
-
no setterinherited
- isVisible → bool
-
Whether the popup is currently visible.
no setterinherited
-
itemRenderer
↔ ItemRenderer<
T> ? -
A simple function to render the an item to string.
@override
getter/setter pairinherited-getteroverride-setter
-
labelFactory
↔ FactoryRenderer<
RendersValue, dynamic> ? -
Factory that returns a component to be used for rendering group labels.
getter/setter pair
- listAutoFocus ↔ bool
-
Whether to focus the options list by default when the popup opens.
getter/setter pair
- listId → String
-
The id for the contained material-list.
final
-
onVisibleChanged
→ Stream<
bool> -
An event stream that fires when the popup's visibility changes.
no setterinherited
-
options
↔ SelectionOptions<
T> -
The available options for this container.
getter/setter pairinherited-getteroverride-setter
- optionsInput ← dynamic
-
Sets the available options for the selection component.
no getteroverride
- popupClassName → String
-
CSS classes from the root element, passed to the popup to allow scoping of
mixins.
final
- popupMatchInputWidth ↔ bool
-
Whether or not the popup width is at least as wide as the select width.
getter/setter pairinherited
-
preferredPositions
↔ List<
RelativePosition> -
Preferred positions for alignment when enforceSpaceConstraints is true
getter/setter pairinherited
- raised ↔ bool
-
Whether the button is raised.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selection
↔ SelectionModel<
T> -
The selection model this container represents.
getter/setter pairinherited-getteroverride-setter
- selectionChange → Stream
-
Emits the selected value(s) whenever selection changes.
no setterinherited
- selectionInput ← dynamic
-
Sets the selected value or selection model for the selection component.
no getterinherited
- showButtonBorder ↔ bool?
-
Whether to show the bottom border of the dropdown button.
getter/setter pair
- showDeselectItem → bool
-
Whether to show select item that deselects the current selection.
no setter
- slide ↔ String?
-
Direction of popup scaling.
getter/setter pairinherited
- trackByIndexFn → TrackByFn
-
Function for use by NgFor for optionGroup.
final
- trackLayoutChanges ↔ bool
-
Sets whether the suggestion list scrolls with the input box.
getter/setter pairinherited
- visible ↔ bool
-
Whether the dropdown is visible.
getter/setter pairinherited-getteroverride-setter
-
visibleStream
→ Stream<
bool> -
Fired when the dropdown's visibility changes.
no setterinherited
- width ↔ int
-
Preset width, 1 through 5. By default, width #0 is used.
Each width multiplies the base block width (64px on desktop and tablet) by
1.5, 3, 5, 6, 7
, respectively to obtain a predictable width. Set to 0 to have the list expand to fit its content. Note: The spec clearly lays out predefined list sizes so use the default, expanding size, sparingly.getter/setter pairinherited-getteroverride-setter
Methods
-
activateOnKeyPress(
ActiveItemModel activeModel, int charCode, SelectionOptions? options, ItemRenderer< T> ? itemRenderer, SelectionModel? selection) → void -
Activates an item in the ActiveItemModel based on the key passed in.
If the current item already matches, it will select the next item that
matches.
inherited
-
close(
) → void -
inherited
-
deselectCurrentSelection(
) → void -
emitSelectionChange(
) → void -
inherited
-
getMaxHeight(
num positionY, num viewportHeight) → num -
The max height.
override
-
getMaxWidth(
num positionX, num viewportWidth) → num -
The max width.
override
-
getMinHeight(
num positionY, num viewportHeight) → num? -
The min height.
override
-
getMinWidth(
num positionX, num viewportWidth) → num? -
The min width.
override
-
handle(
UIEvent event, dynamic activatedValue) → bool -
Handles updating the selection model from MouseEvent activations.
inherited
-
handleBackspaceKey(
KeyboardEvent event) → void -
inherited
-
handleCharCodeKey(
KeyboardEvent event) → void -
override
-
handleClick(
UIEvent event) → void -
handleDeleteKey(
KeyboardEvent event) → void -
inherited
-
handleDownKey(
KeyboardEvent event) → void -
override
-
handleEndKey(
KeyboardEvent event) → void -
inherited
-
handleEnterKey(
KeyboardEvent event) → void -
override
-
handleEscapeKey(
KeyboardEvent event) → void -
inherited
-
handleHomeKey(
KeyboardEvent event) → void -
inherited
-
handleLeftKey(
KeyboardEvent event) → void -
override
-
handlePageDown(
KeyboardEvent event) → void -
override
-
handlePageUp(
KeyboardEvent event) → void -
override
-
handleRightKey(
KeyboardEvent event) → void -
override
-
handleSpaceKey(
KeyboardEvent event) → void -
override
-
handleUpKey(
KeyboardEvent event) → void -
override
-
isOptionDisabled(
T item) → bool - If selectionOptions implements Selectable, it is called.
-
isOptionHidden(
T item) → bool -
Whether to hide
item
. -
ngAfterChanges(
) → 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
-
onBlur(
FocusEvent event) → void -
onFocus(
FocusEvent event) → void -
onKeyDown(
KeyboardEvent event) → void -
Keydown callback used to handle arrow keys.
inherited
-
onKeyPress(
KeyboardEvent event) → void -
Keypress callback used to handle enter and space keys.
inherited
-
onKeyUp(
KeyboardEvent event) → void -
Keyup callback used to handle escape keys.
inherited
-
onVisible(
bool vis) → void -
inherited
-
open(
) → void -
inherited
-
resetEnteredKeys(
) → void -
inherited
-
toggle(
) → void -
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited