mirror of
https://github.com/nunntom/elm-ui-select.git
synced 2024-11-23 05:22:34 +03:00
Change position fixed element width
This commit is contained in:
parent
b47a40d9c4
commit
d04c817447
@ -115,7 +115,6 @@ toElement_ placement filteredOptions model config =
|
|||||||
, menuOpen = Model.isOpen model
|
, menuOpen = Model.isOpen model
|
||||||
, options = filteredOptions
|
, options = filteredOptions
|
||||||
, optionElement = config.optionElement
|
, optionElement = config.optionElement
|
||||||
, positionFixed = config.positionFixed
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
++ (if Model.isOpen model then
|
++ (if Model.isOpen model then
|
||||||
@ -197,20 +196,13 @@ menuView :
|
|||||||
, menuOpen : Bool
|
, menuOpen : Bool
|
||||||
, options : List (Option a)
|
, options : List (Option a)
|
||||||
, optionElement : OptionState -> a -> Element msg
|
, optionElement : OptionState -> a -> Element msg
|
||||||
, positionFixed : Bool
|
|
||||||
}
|
}
|
||||||
-> Element msg
|
-> Element msg
|
||||||
menuView attribs v =
|
menuView attribs v =
|
||||||
List.indexedMap (optionElement v) v.options
|
List.indexedMap (optionElement v) v.options
|
||||||
|> Element.column (attribs ++ [ Element.htmlAttribute <| Html.Attributes.id v.menuId ])
|
|> Element.column (attribs ++ [ Element.htmlAttribute <| Html.Attributes.id v.menuId ])
|
||||||
|> Element.el
|
|> Element.el
|
||||||
(Element.width
|
(Element.width Element.fill
|
||||||
(if v.positionFixed then
|
|
||||||
Element.fill
|
|
||||||
|
|
||||||
else
|
|
||||||
Element.shrink
|
|
||||||
)
|
|
||||||
:: (if v.menuOpen && List.length v.options > 0 then
|
:: (if v.menuOpen && List.length v.options > 0 then
|
||||||
[]
|
[]
|
||||||
|
|
||||||
@ -299,10 +291,8 @@ defaultMenuAttrs { menuWidth, maxWidth, menuHeight } =
|
|||||||
positionFixedEl : Placement -> Maybe Dom.Element -> Element msg -> Element msg
|
positionFixedEl : Placement -> Maybe Dom.Element -> Element msg -> Element msg
|
||||||
positionFixedEl placement container =
|
positionFixedEl placement container =
|
||||||
Element.el
|
Element.el
|
||||||
([ style "position" "fixed"
|
(style "position" "fixed"
|
||||||
, Element.width Element.fill
|
:: (if placement == Placement.Above then
|
||||||
]
|
|
||||||
++ (if placement == Placement.Above then
|
|
||||||
[ style "transform"
|
[ style "transform"
|
||||||
("translateY(calc(-100% - 5px - "
|
("translateY(calc(-100% - 5px - "
|
||||||
++ (Maybe.map (.element >> .height >> String.fromFloat) container |> Maybe.withDefault "0")
|
++ (Maybe.map (.element >> .height >> String.fromFloat) container |> Maybe.withDefault "0")
|
||||||
|
Loading…
Reference in New Issue
Block a user