Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
dff65fff
Commit
dff65fff
authored
Jul 07, 2021
by
David Davó
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Select widgets
parent
362bef6e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
36 additions
and
95 deletions
+36
-95
Common.hs
...y/ihaskell-widgets/src/IHaskell/Display/Widgets/Common.hs
+2
-4
Dropdown.hs
...idgets/src/IHaskell/Display/Widgets/Selection/Dropdown.hs
+4
-13
RadioButtons.hs
...ts/src/IHaskell/Display/Widgets/Selection/RadioButtons.hs
+4
-13
Select.hs
...-widgets/src/IHaskell/Display/Widgets/Selection/Select.hs
+4
-13
SelectMultiple.hs
.../src/IHaskell/Display/Widgets/Selection/SelectMultiple.hs
+5
-14
ToggleButtons.hs
...s/src/IHaskell/Display/Widgets/Selection/ToggleButtons.hs
+4
-13
Singletons.hs
...askell-widgets/src/IHaskell/Display/Widgets/Singletons.hs
+2
-4
Types.hs
...ay/ihaskell-widgets/src/IHaskell/Display/Widgets/Types.hs
+10
-20
Types.hs
src/IHaskell/Types.hs
+1
-1
No files found.
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Common.hs
View file @
dff65fff
...
@@ -62,13 +62,11 @@ pattern B64Value = S.SB64Value
...
@@ -62,13 +62,11 @@ pattern B64Value = S.SB64Value
pattern
ImageFormat
=
S
.
SImageFormat
pattern
ImageFormat
=
S
.
SImageFormat
pattern
BoolValue
=
S
.
SBoolValue
pattern
BoolValue
=
S
.
SBoolValue
pattern
Options
=
S
.
SOptions
pattern
Options
=
S
.
SOptions
pattern
SelectedLabel
=
S
.
SSelectedLabel
pattern
Index
=
S
.
SIndex
pattern
SelectedValue
=
S
.
SSelectedValue
pattern
SelectionHandler
=
S
.
SSelectionHandler
pattern
SelectionHandler
=
S
.
SSelectionHandler
pattern
Tooltips
=
S
.
STooltips
pattern
Tooltips
=
S
.
STooltips
pattern
Icons
=
S
.
SIcons
pattern
Icons
=
S
.
SIcons
pattern
SelectedLabels
=
S
.
SSelectedLabels
pattern
Indices
=
S
.
SIndices
pattern
SelectedValues
=
S
.
SSelectedValues
pattern
IntValue
=
S
.
SIntValue
pattern
IntValue
=
S
.
SIntValue
pattern
StepInt
=
S
.
SStepInt
pattern
StepInt
=
S
.
SStepInt
pattern
MaxInt
=
S
.
SMaxInt
pattern
MaxInt
=
S
.
SMaxInt
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Selection/Dropdown.hs
View file @
dff65fff
...
@@ -18,6 +18,7 @@ import Prelude
...
@@ -18,6 +18,7 @@ import Prelude
import
Control.Monad
(
void
)
import
Control.Monad
(
void
)
import
Data.Aeson
import
Data.Aeson
import
Data.IORef
(
newIORef
)
import
Data.IORef
(
newIORef
)
import
qualified
Data.Scientific
as
Sci
import
Data.Vinyl
(
Rec
(
..
),
(
<+>
))
import
Data.Vinyl
(
Rec
(
..
),
(
<+>
))
import
IHaskell.Display
import
IHaskell.Display
...
@@ -52,18 +53,8 @@ mkDropdown = do
...
@@ -52,18 +53,8 @@ mkDropdown = do
instance
IHaskellWidget
Dropdown
where
instance
IHaskellWidget
Dropdown
where
getCommUUID
=
uuid
getCommUUID
=
uuid
comm
widget
val
_
=
comm
widget
val
_
=
case
nestedObjectLookup
val
[
"sync_data"
,
"selected_label"
]
of
case
nestedObjectLookup
val
[
"state"
,
"index"
]
of
Just
(
String
label
)
->
do
Just
(
Number
index
)
->
do
opts
<-
getField
widget
Options
void
$
setField'
widget
Index
(
Sci
.
coefficient
index
)
case
opts
of
OptionLabels
_
->
do
void
$
setField'
widget
SelectedLabel
label
void
$
setField'
widget
SelectedValue
label
OptionDict
ps
->
case
lookup
label
ps
of
Nothing
->
return
()
Just
value
->
do
void
$
setField'
widget
SelectedLabel
label
void
$
setField'
widget
SelectedValue
value
triggerSelection
widget
triggerSelection
widget
_
->
pure
()
_
->
pure
()
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Selection/RadioButtons.hs
View file @
dff65fff
...
@@ -18,6 +18,7 @@ import Prelude
...
@@ -18,6 +18,7 @@ import Prelude
import
Control.Monad
(
void
)
import
Control.Monad
(
void
)
import
Data.Aeson
import
Data.Aeson
import
Data.IORef
(
newIORef
)
import
Data.IORef
(
newIORef
)
import
qualified
Data.Scientific
as
Sci
import
IHaskell.Display
import
IHaskell.Display
import
IHaskell.Eval.Widgets
import
IHaskell.Eval.Widgets
...
@@ -49,18 +50,8 @@ mkRadioButtons = do
...
@@ -49,18 +50,8 @@ mkRadioButtons = do
instance
IHaskellWidget
RadioButtons
where
instance
IHaskellWidget
RadioButtons
where
getCommUUID
=
uuid
getCommUUID
=
uuid
comm
widget
val
_
=
comm
widget
val
_
=
case
nestedObjectLookup
val
[
"sync_data"
,
"selected_label"
]
of
case
nestedObjectLookup
val
[
"state"
,
"index"
]
of
Just
(
String
label
)
->
do
Just
(
Number
index
)
->
do
opts
<-
getField
widget
Options
void
$
setField'
widget
Index
(
Sci
.
coefficient
index
)
case
opts
of
OptionLabels
_
->
do
void
$
setField'
widget
SelectedLabel
label
void
$
setField'
widget
SelectedValue
label
OptionDict
ps
->
case
lookup
label
ps
of
Nothing
->
pure
()
Just
value
->
do
void
$
setField'
widget
SelectedLabel
label
void
$
setField'
widget
SelectedValue
value
triggerSelection
widget
triggerSelection
widget
_
->
pure
()
_
->
pure
()
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Selection/Select.hs
View file @
dff65fff
...
@@ -18,6 +18,7 @@ import Prelude
...
@@ -18,6 +18,7 @@ import Prelude
import
Control.Monad
(
void
)
import
Control.Monad
(
void
)
import
Data.Aeson
import
Data.Aeson
import
Data.IORef
(
newIORef
)
import
Data.IORef
(
newIORef
)
import
qualified
Data.Scientific
as
Sci
import
IHaskell.Display
import
IHaskell.Display
import
IHaskell.Eval.Widgets
import
IHaskell.Eval.Widgets
...
@@ -49,18 +50,8 @@ mkSelect = do
...
@@ -49,18 +50,8 @@ mkSelect = do
instance
IHaskellWidget
Select
where
instance
IHaskellWidget
Select
where
getCommUUID
=
uuid
getCommUUID
=
uuid
comm
widget
val
_
=
comm
widget
val
_
=
case
nestedObjectLookup
val
[
"sync_data"
,
"selected_label"
]
of
case
nestedObjectLookup
val
[
"state"
,
"index"
]
of
Just
(
String
label
)
->
do
Just
(
Number
index
)
->
do
opts
<-
getField
widget
Options
void
$
setField'
widget
Index
(
Sci
.
coefficient
index
)
case
opts
of
OptionLabels
_
->
do
void
$
setField'
widget
SelectedLabel
label
void
$
setField'
widget
SelectedValue
label
OptionDict
ps
->
case
lookup
label
ps
of
Nothing
->
pure
()
Just
value
->
do
void
$
setField'
widget
SelectedLabel
label
void
$
setField'
widget
SelectedValue
value
triggerSelection
widget
triggerSelection
widget
_
->
pure
()
_
->
pure
()
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Selection/SelectMultiple.hs
View file @
dff65fff
...
@@ -18,6 +18,7 @@ import Prelude
...
@@ -18,6 +18,7 @@ import Prelude
import
Control.Monad
(
void
)
import
Control.Monad
(
void
)
import
Data.Aeson
import
Data.Aeson
import
Data.IORef
(
newIORef
)
import
Data.IORef
(
newIORef
)
import
qualified
Data.Scientific
as
Sci
import
qualified
Data.Vector
as
V
import
qualified
Data.Vector
as
V
import
IHaskell.Display
import
IHaskell.Display
...
@@ -50,19 +51,9 @@ mkSelectMultiple = do
...
@@ -50,19 +51,9 @@ mkSelectMultiple = do
instance
IHaskellWidget
SelectMultiple
where
instance
IHaskellWidget
SelectMultiple
where
getCommUUID
=
uuid
getCommUUID
=
uuid
comm
widget
val
_
=
comm
widget
val
_
=
case
nestedObjectLookup
val
[
"sync_data"
,
"selected_labels"
]
of
case
nestedObjectLookup
val
[
"state"
,
"index"
]
of
Just
(
Array
labels
)
->
do
Just
(
Array
indices
)
->
do
let
labelList
=
map
(
\
(
String
x
)
->
x
)
$
V
.
toList
labels
let
indicesList
=
map
(
\
(
Number
x
)
->
Sci
.
coefficient
x
)
$
V
.
toList
indices
opts
<-
getField
widget
Options
void
$
setField'
widget
Indices
indicesList
case
opts
of
OptionLabels
_
->
do
void
$
setField'
widget
SelectedLabels
labelList
void
$
setField'
widget
SelectedValues
labelList
OptionDict
ps
->
case
mapM
(`
lookup
`
ps
)
labelList
of
Nothing
->
pure
()
Just
valueList
->
do
void
$
setField'
widget
SelectedLabels
labelList
void
$
setField'
widget
SelectedValues
valueList
triggerSelection
widget
triggerSelection
widget
_
->
pure
()
_
->
pure
()
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Selection/ToggleButtons.hs
View file @
dff65fff
...
@@ -18,6 +18,7 @@ import Prelude
...
@@ -18,6 +18,7 @@ import Prelude
import
Control.Monad
(
void
)
import
Control.Monad
(
void
)
import
Data.Aeson
import
Data.Aeson
import
Data.IORef
(
newIORef
)
import
Data.IORef
(
newIORef
)
import
qualified
Data.Scientific
as
Sci
import
Data.Vinyl
(
Rec
(
..
),
(
<+>
))
import
Data.Vinyl
(
Rec
(
..
),
(
<+>
))
import
IHaskell.Display
import
IHaskell.Display
...
@@ -55,18 +56,8 @@ mkToggleButtons = do
...
@@ -55,18 +56,8 @@ mkToggleButtons = do
instance
IHaskellWidget
ToggleButtons
where
instance
IHaskellWidget
ToggleButtons
where
getCommUUID
=
uuid
getCommUUID
=
uuid
comm
widget
val
_
=
comm
widget
val
_
=
case
nestedObjectLookup
val
[
"sync_data"
,
"selected_label"
]
of
case
nestedObjectLookup
val
[
"state"
,
"index"
]
of
Just
(
String
label
)
->
do
Just
(
Number
index
)
->
do
opts
<-
getField
widget
Options
void
$
setField'
widget
Index
(
Sci
.
coefficient
index
)
case
opts
of
OptionLabels
_
->
void
$
do
void
$
setField'
widget
SelectedLabel
label
void
$
setField'
widget
SelectedValue
label
OptionDict
ps
->
case
lookup
label
ps
of
Nothing
->
pure
()
Just
value
->
do
void
$
setField'
widget
SelectedLabel
label
void
$
setField'
widget
SelectedValue
value
triggerSelection
widget
triggerSelection
widget
_
->
pure
()
_
->
pure
()
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Singletons.hs
View file @
dff65fff
...
@@ -68,13 +68,11 @@ singletons
...
@@ -68,13 +68,11 @@ singletons
| ImageFormat
| ImageFormat
| BoolValue
| BoolValue
| Options
| Options
| SelectedLabel
| Index
| SelectedValue
| SelectionHandler
| SelectionHandler
| Tooltips
| Tooltips
| Icons
| Icons
| SelectedLabels
| Indices
| SelectedValues
| IntValue
| IntValue
| StepInt
| StepInt
| MaxInt
| MaxInt
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Types.hs
View file @
dff65fff
...
@@ -136,10 +136,10 @@ type StringClass = DOMWidgetClass :++ ['S.StringValue, 'S.Disabled, 'S.Descripti
...
@@ -136,10 +136,10 @@ type StringClass = DOMWidgetClass :++ ['S.StringValue, 'S.Disabled, 'S.Descripti
type
BoolClass
=
DOMWidgetClass
:++
[
'S
.
BoolValue
,
'S
.
Disabled
,
'S
.
Description
,
'S
.
ChangeHandler
]
type
BoolClass
=
DOMWidgetClass
:++
[
'S
.
BoolValue
,
'S
.
Disabled
,
'S
.
Description
,
'S
.
ChangeHandler
]
type
SelectionClass
=
DOMWidgetClass
:++
[
'S
.
Options
,
'S
.
SelectedValue
,
'S
.
SelectedLabel
,
'S
.
Disabled
,
type
SelectionClass
=
DOMWidgetClass
:++
[
'S
.
Options
,
'S
.
Index
,
'S
.
Disabled
,
'S
.
Description
,
'S
.
SelectionHandler
]
'S
.
Description
,
'S
.
SelectionHandler
]
type
MultipleSelectionClass
=
DOMWidgetClass
:++
[
'S
.
Options
,
'S
.
SelectedValues
,
'S
.
SelectedLabel
s
,
'S
.
Disabled
,
type
MultipleSelectionClass
=
DOMWidgetClass
:++
[
'S
.
Options
,
'S
.
Indice
s
,
'S
.
Disabled
,
'S
.
Description
,
'S
.
SelectionHandler
]
'S
.
Description
,
'S
.
SelectionHandler
]
type
IntClass
=
DOMWidgetClass
:++
[
'S
.
IntValue
,
'S
.
Disabled
,
'S
.
Description
,
'S
.
ChangeHandler
]
type
IntClass
=
DOMWidgetClass
:++
[
'S
.
IntValue
,
'S
.
Disabled
,
'S
.
Description
,
'S
.
ChangeHandler
]
...
@@ -202,13 +202,11 @@ type family FieldType (f :: Field) :: * where
...
@@ -202,13 +202,11 @@ type family FieldType (f :: Field) :: * where
FieldType
'S
.
ImageFormat
=
ImageFormatValue
FieldType
'S
.
ImageFormat
=
ImageFormatValue
FieldType
'S
.
BoolValue
=
Bool
FieldType
'S
.
BoolValue
=
Bool
FieldType
'S
.
Options
=
SelectionOptions
FieldType
'S
.
Options
=
SelectionOptions
FieldType
'S
.
SelectedLabel
=
Text
FieldType
'S
.
Index
=
Integer
FieldType
'S
.
SelectedValue
=
Text
FieldType
'S
.
SelectionHandler
=
IO
()
FieldType
'S
.
SelectionHandler
=
IO
()
FieldType
'S
.
Tooltips
=
[
Text
]
FieldType
'S
.
Tooltips
=
[
Text
]
FieldType
'S
.
Icons
=
[
Text
]
FieldType
'S
.
Icons
=
[
Text
]
FieldType
'S
.
SelectedLabels
=
[
Text
]
FieldType
'S
.
Indices
=
[
Integer
]
FieldType
'S
.
SelectedValues
=
[
Text
]
FieldType
'S
.
IntValue
=
Integer
FieldType
'S
.
IntValue
=
Integer
FieldType
'S
.
StepInt
=
Integer
FieldType
'S
.
StepInt
=
Integer
FieldType
'S
.
MinInt
=
Integer
FieldType
'S
.
MinInt
=
Integer
...
@@ -490,11 +488,8 @@ instance ToPairs (Attr 'S.ImageFormat) where
...
@@ -490,11 +488,8 @@ instance ToPairs (Attr 'S.ImageFormat) where
instance
ToPairs
(
Attr
'S
.
BoolValue
)
where
instance
ToPairs
(
Attr
'S
.
BoolValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
'S
.
SelectedLabel
)
where
instance
ToPairs
(
Attr
'S
.
Index
)
where
toPairs
x
=
[
"selected_label"
.=
toJSON
x
]
toPairs
x
=
[
"index"
.=
toJSON
x
]
instance
ToPairs
(
Attr
'S
.
SelectedValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
'S
.
Options
)
where
instance
ToPairs
(
Attr
'S
.
Options
)
where
toPairs
x
=
toPairs
x
=
...
@@ -514,11 +509,8 @@ instance ToPairs (Attr 'S.Tooltips) where
...
@@ -514,11 +509,8 @@ instance ToPairs (Attr 'S.Tooltips) where
instance
ToPairs
(
Attr
'S
.
Icons
)
where
instance
ToPairs
(
Attr
'S
.
Icons
)
where
toPairs
x
=
[
"icons"
.=
toJSON
x
]
toPairs
x
=
[
"icons"
.=
toJSON
x
]
instance
ToPairs
(
Attr
'S
.
SelectedLabels
)
where
instance
ToPairs
(
Attr
'S
.
Indices
)
where
toPairs
x
=
[
"selected_labels"
.=
toJSON
x
]
toPairs
x
=
[
"index"
.=
toJSON
x
]
instance
ToPairs
(
Attr
'S
.
SelectedValues
)
where
toPairs
x
=
[
"values"
.=
toJSON
x
]
instance
ToPairs
(
Attr
'S
.
IntValue
)
where
instance
ToPairs
(
Attr
'S
.
IntValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
toPairs
x
=
[
"value"
.=
toJSON
x
]
...
@@ -710,8 +702,7 @@ defaultSelectionWidget :: FieldType 'S.ViewName -> FieldType 'S.ModelName -> Rec
...
@@ -710,8 +702,7 @@ defaultSelectionWidget :: FieldType 'S.ViewName -> FieldType 'S.ModelName -> Rec
defaultSelectionWidget
viewName
modelName
=
defaultDOMWidget
viewName
modelName
<+>
selectionAttrs
defaultSelectionWidget
viewName
modelName
=
defaultDOMWidget
viewName
modelName
<+>
selectionAttrs
where
where
selectionAttrs
=
(
Options
=::
OptionLabels
[]
)
selectionAttrs
=
(
Options
=::
OptionLabels
[]
)
:&
(
SelectedValue
=::
""
)
:&
(
Index
=::
0
)
:&
(
SelectedLabel
=::
""
)
:&
(
Disabled
=::
False
)
:&
(
Disabled
=::
False
)
:&
(
Description
=::
""
)
:&
(
Description
=::
""
)
:&
(
SelectionHandler
=::
return
()
)
:&
(
SelectionHandler
=::
return
()
)
...
@@ -722,8 +713,7 @@ defaultMultipleSelectionWidget :: FieldType 'S.ViewName -> FieldType 'S.ModelNam
...
@@ -722,8 +713,7 @@ defaultMultipleSelectionWidget :: FieldType 'S.ViewName -> FieldType 'S.ModelNam
defaultMultipleSelectionWidget
viewName
modelName
=
defaultDOMWidget
viewName
modelName
<+>
mulSelAttrs
defaultMultipleSelectionWidget
viewName
modelName
=
defaultDOMWidget
viewName
modelName
<+>
mulSelAttrs
where
where
mulSelAttrs
=
(
Options
=::
OptionLabels
[]
)
mulSelAttrs
=
(
Options
=::
OptionLabels
[]
)
:&
(
SelectedValues
=::
[]
)
:&
(
Indices
=::
[]
)
:&
(
SelectedLabels
=::
[]
)
:&
(
Disabled
=::
False
)
:&
(
Disabled
=::
False
)
:&
(
Description
=::
""
)
:&
(
Description
=::
""
)
:&
(
SelectionHandler
=::
return
()
)
:&
(
SelectionHandler
=::
return
()
)
...
...
src/IHaskell/Types.hs
View file @
dff65fff
...
@@ -43,7 +43,7 @@ module IHaskell.Types (
...
@@ -43,7 +43,7 @@ module IHaskell.Types (
import
IHaskellPrelude
import
IHaskellPrelude
import
qualified
Data.HashMap.Strict
as
HashMap
import
qualified
Data.HashMap.Strict
as
HashMap
import
Data.Aeson
(
ToJSON
(
..
),
Value
,
(
.=
),
object
,
Object
,
Value
(
String
))
import
Data.Aeson
(
ToJSON
(
..
),
Value
,
(
.=
),
object
,
Value
(
String
))
import
Data.Function
(
on
)
import
Data.Function
(
on
)
import
Data.Text
(
pack
)
import
Data.Text
(
pack
)
import
Data.Serialize
import
Data.Serialize
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment