Extend dropdown to display additional option info

Use this to display folder information when setting the folder on an
item.
This commit is contained in:
Eike Kettner
2020-07-11 17:45:45 +02:00
parent 0df541f30a
commit e66c501056
13 changed files with 171 additions and 46 deletions

View File

@ -8,6 +8,8 @@ module Comp.Dropdown exposing
, makeMultiple
, makeSingle
, makeSingleList
, mkOption
, setMkOption
, update
, view
)
@ -27,9 +29,15 @@ import Util.List
type alias Option =
{ value : String
, text : String
, additional : String
}
mkOption : String -> String -> Option
mkOption value text =
Option value text ""
type alias Item a =
{ value : a
, option : Option
@ -63,6 +71,11 @@ type alias Model a =
}
setMkOption : (a -> Option) -> Model a -> Model a
setMkOption mkopt model =
{ model | makeOption = mkopt }
makeModel :
{ multiple : Bool
, searchable : Int -> Bool
@ -508,4 +521,7 @@ renderOption item =
, onClick (AddItem item)
]
[ text item.option.text
, span [ class "small-info right-float" ]
[ text item.option.additional
]
]