mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
Allow to select multiple items for deletion and edit
This commit is contained in:
32
modules/webapp/src/main/elm/Data/ItemSelection.elm
Normal file
32
modules/webapp/src/main/elm/Data/ItemSelection.elm
Normal file
@ -0,0 +1,32 @@
|
||||
module Data.ItemSelection exposing
|
||||
( ItemSelection(..)
|
||||
, isActive
|
||||
, isSelected
|
||||
)
|
||||
|
||||
import Set exposing (Set)
|
||||
|
||||
|
||||
type ItemSelection
|
||||
= Inactive
|
||||
| Active (Set String)
|
||||
|
||||
|
||||
isSelected : String -> ItemSelection -> Bool
|
||||
isSelected id set =
|
||||
case set of
|
||||
Inactive ->
|
||||
False
|
||||
|
||||
Active ids ->
|
||||
Set.member id ids
|
||||
|
||||
|
||||
isActive : ItemSelection -> Bool
|
||||
isActive sel =
|
||||
case sel of
|
||||
Active _ ->
|
||||
True
|
||||
|
||||
Inactive ->
|
||||
False
|
Reference in New Issue
Block a user