Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Dropdown widget, allowing selection of a single item from a collapsable list.
Both header and list content is customizable, plus its styling. In case only
text content is needed, TextDropdown
is easier to use.
Configs:
- onFocus: event to raise when focus is received.
- onFocusReq: WidgetReqest to generate when focus is received.
- onBlur: event to raise when focus is lost.
- onBlurReq: WidgetReqest to generate when focus is lost.
- onChange: event to raise when selected item changes.
- onChangeReq: WidgetRequest to generate when selected item changes.
- onChangeIdx: event to raise when selected item changes. Includes index,
- onChangeIdxReq: WidgetRequest to generate when selected item changes. Includes index.
- maxHeight: maximum height of the list when dropdown is expanded.
- itemBasicStyle: style of an item in the list when not selected.
- itemSelectedStyle: style of the selected item in the list.
Synopsis
- data DropdownCfg s e a
- type DropdownItem a = SelectListItem a
- dropdown :: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) => ALens' s a -> t a -> (a -> WidgetNode s e) -> (a -> WidgetNode s e) -> WidgetNode s e
- dropdown_ :: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) => ALens' s a -> t a -> (a -> WidgetNode s e) -> (a -> WidgetNode s e) -> [DropdownCfg s e a] -> WidgetNode s e
- dropdownV :: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) => a -> (Int -> a -> e) -> t a -> (a -> WidgetNode s e) -> (a -> WidgetNode s e) -> WidgetNode s e
- dropdownV_ :: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) => a -> (Int -> a -> e) -> t a -> (a -> WidgetNode s e) -> (a -> WidgetNode s e) -> [DropdownCfg s e a] -> WidgetNode s e
- dropdownD_ :: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) => WidgetData s a -> t a -> (a -> WidgetNode s e) -> (a -> WidgetNode s e) -> [DropdownCfg s e a] -> WidgetNode s e
Documentation
data DropdownCfg s e a Source #
Configuration options for dropdown widget.
Instances
type DropdownItem a = SelectListItem a Source #
Constraints for an item handled by dropdown.
:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) | |
=> ALens' s a | The lens into the model. |
-> t a | The list of selectable items. |
-> (a -> WidgetNode s e) | Function to create the header (always visible). |
-> (a -> WidgetNode s e) | Function to create the list (collapsable). |
-> WidgetNode s e | The created dropdown. |
Creates a dropdown using the given lens.
:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) | |
=> ALens' s a | The lens into the model. |
-> t a | The list of selectable items. |
-> (a -> WidgetNode s e) | Function to create the header (always visible). |
-> (a -> WidgetNode s e) | Function to create the list (collapsable). |
-> [DropdownCfg s e a] | The config options. |
-> WidgetNode s e | The created dropdown. |
Creates a dropdown using the given lens. Accepts config.
:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) | |
=> a | The current value. |
-> (Int -> a -> e) | The event to raise on change. |
-> t a | The list of selectable items. |
-> (a -> WidgetNode s e) | Function to create the header (always visible). |
-> (a -> WidgetNode s e) | Function to create the list (collapsable). |
-> WidgetNode s e | The created dropdown. |
Creates a dropdown using the given value and onChange event handler.
:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) | |
=> a | The current value. |
-> (Int -> a -> e) | The event to raise on change. |
-> t a | The list of selectable items. |
-> (a -> WidgetNode s e) | Function to create the header (always visible). |
-> (a -> WidgetNode s e) | Function to create the list (collapsable). |
-> [DropdownCfg s e a] | The config options. |
-> WidgetNode s e | The created dropdown. |
Creates a dropdown using the given value and onChange event handler. | Accepts config.
:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) | |
=> WidgetData s a | The WidgetData to retrieve the value from. |
-> t a | The list of selectable items. |
-> (a -> WidgetNode s e) | Function to create the header (always visible). |
-> (a -> WidgetNode s e) | Function to create the list (collapsable). |
-> [DropdownCfg s e a] | The config options. |
-> WidgetNode s e | The created dropdown. |
Creates a dropdown providing a WidgetData instance and config.