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
5a03d3dd
Commit
5a03d3dd
authored
Jul 18, 2021
by
David Davó
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Selection widget demo
parent
d26ecb02
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
479 additions
and
78 deletions
+479
-78
Selection Widgets.ipynb
...display/ihaskell-widgets/Examples/Selection Widgets.ipynb
+466
-75
SelectionRangeSlider.hs
...Haskell/Display/Widgets/Selection/SelectionRangeSlider.hs
+1
-1
Types.hs
...ay/ihaskell-widgets/src/IHaskell/Display/Widgets/Types.hs
+12
-2
No files found.
ihaskell-display/ihaskell-widgets/Examples/Selection Widgets.ipynb
View file @
5a03d3dd
This diff is collapsed.
Click to expand it.
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Selection/SelectionRangeSlider.hs
View file @
5a03d3dd
...
@@ -41,7 +41,7 @@ mkSelectionRangeSlider = do
...
@@ -41,7 +41,7 @@ mkSelectionRangeSlider = do
:&
(
ReadOut
=::
True
)
:&
(
ReadOut
=::
True
)
:&
(
ContinuousUpdate
=::
True
)
:&
(
ContinuousUpdate
=::
True
)
:&
RNil
:&
RNil
widgetState
=
WidgetState
$
rput
(
Indices
=:
:
[
0
,
0
]
)
$
selectionAttrs
<+>
selectionRangeSliderAttrs
widgetState
=
WidgetState
$
rput
(
Indices
=:
.
([
0
,
0
],
rangeSliderVerification
)
)
$
selectionAttrs
<+>
selectionRangeSliderAttrs
stateIO
<-
newIORef
widgetState
stateIO
<-
newIORef
widgetState
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Types.hs
View file @
5a03d3dd
...
@@ -128,7 +128,7 @@ type CoreWidgetClass = ['S.ViewModule, 'S.ViewModuleVersion, 'S.ModelModule, 'S.
...
@@ -128,7 +128,7 @@ type CoreWidgetClass = ['S.ViewModule, 'S.ViewModuleVersion, 'S.ModelModule, 'S.
type
DOMWidgetClass
=
[
'S
.
ModelName
,
'S
.
ViewName
,
'S
.
DOMClasses
,
'S
.
Tabbable
,
'S
.
Tooltip
,
'S
.
DisplayHandler
]
-- TODO: Add layout
type
DOMWidgetClass
=
[
'S
.
ModelName
,
'S
.
ViewName
,
'S
.
DOMClasses
,
'S
.
Tabbable
,
'S
.
Tooltip
,
'S
.
DisplayHandler
]
-- TODO: Add layout
type
DescriptionWidgetClass
=
CoreWidgetClass
++
DOMWidgetClass
:++
'[
'S
.
Description
]
type
DescriptionWidgetClass
=
CoreWidgetClass
:
++
DOMWidgetClass
:++
'[
'S
.
Description
]
type
StringClass
=
DescriptionWidgetClass
:++
[
'S
.
StringValue
,
'S
.
Placeholder
]
type
StringClass
=
DescriptionWidgetClass
:++
[
'S
.
StringValue
,
'S
.
Placeholder
]
...
@@ -323,7 +323,7 @@ type family WidgetFields (w :: WidgetType) :: [Field] where
...
@@ -323,7 +323,7 @@ type family WidgetFields (w :: WidgetType) :: [Field] where
WidgetFields
'S
e
lectionRangeSliderType
=
MultipleSelectionClass
:++
'[
'S
.
Orientation
,
'S
.
ReadOut
,
'S
.
ContinuousUpdate
]
WidgetFields
'S
e
lectionRangeSliderType
=
MultipleSelectionClass
:++
'[
'S
.
Orientation
,
'S
.
ReadOut
,
'S
.
ContinuousUpdate
]
WidgetFields
'T
o
ggleButtonsType
=
WidgetFields
'T
o
ggleButtonsType
=
SelectionClass
:++
[
'S
.
Tooltips
,
'S
.
Icons
,
'S
.
ButtonStyle
]
SelectionClass
:++
[
'S
.
Tooltips
,
'S
.
Icons
,
'S
.
ButtonStyle
]
WidgetFields
'S
e
lectMultipleType
=
MultipleSelectionClass
++
'[
S
.
Rows
]
WidgetFields
'S
e
lectMultipleType
=
MultipleSelectionClass
:++
'[
'
S
.
Rows
]
WidgetFields
'I
n
tTextType
=
IntClass
:++
[
'S
.
Disabled
,
'S
.
ContinuousUpdate
,
'S
.
StepInt
]
WidgetFields
'I
n
tTextType
=
IntClass
:++
[
'S
.
Disabled
,
'S
.
ContinuousUpdate
,
'S
.
StepInt
]
WidgetFields
'B
o
undedIntTextType
=
BoundedIntClass
:++
[
'S
.
Disabled
,
'S
.
ContinuousUpdate
,
'S
.
StepInt
]
WidgetFields
'B
o
undedIntTextType
=
BoundedIntClass
:++
[
'S
.
Disabled
,
'S
.
ContinuousUpdate
,
'S
.
StepInt
]
WidgetFields
'I
n
tSliderType
=
WidgetFields
'I
n
tSliderType
=
...
@@ -587,6 +587,10 @@ instance ToPairs (Attr 'S.Rows) where
...
@@ -587,6 +587,10 @@ instance ToPairs (Attr 'S.Rows) where
(
=::
)
::
(
SingI
f
,
Typeable
(
FieldType
f
))
=>
Sing
f
->
FieldType
f
->
Attr
f
(
=::
)
::
(
SingI
f
,
Typeable
(
FieldType
f
))
=>
Sing
f
->
FieldType
f
->
Attr
f
s
=::
x
=
Attr
{
_value
=
Real
x
,
_verify
=
return
,
_field
=
reflect
s
}
s
=::
x
=
Attr
{
_value
=
Real
x
,
_verify
=
return
,
_field
=
reflect
s
}
-- | Store the value for a field, with a custom verification
(
=:.
)
::
(
SingI
f
,
Typeable
(
FieldType
f
))
=>
Sing
f
->
(
FieldType
f
,
FieldType
f
->
IO
(
FieldType
f
)
)
->
Attr
f
s
=:.
(
x
,
v
)
=
Attr
{
_value
=
Real
x
,
_verify
=
v
,
_field
=
reflect
s
}
-- | If the number is in the range, return it. Otherwise raise the appropriate (over/under)flow
-- | If the number is in the range, return it. Otherwise raise the appropriate (over/under)flow
-- exception.
-- exception.
rangeCheck
::
(
Num
a
,
Ord
a
)
=>
(
a
,
a
)
->
a
->
IO
a
rangeCheck
::
(
Num
a
,
Ord
a
)
=>
(
a
,
a
)
->
a
->
IO
a
...
@@ -596,6 +600,12 @@ rangeCheck (l, u) x
...
@@ -596,6 +600,12 @@ rangeCheck (l, u) x
|
u
<
x
=
Ex
.
throw
Ex
.
Overflow
|
u
<
x
=
Ex
.
throw
Ex
.
Overflow
|
otherwise
=
error
"The impossible happened in IHaskell.Display.Widgets.Types.rangeCheck"
|
otherwise
=
error
"The impossible happened in IHaskell.Display.Widgets.Types.rangeCheck"
rangeSliderVerification
::
[
Integer
]
->
IO
[
Integer
]
rangeSliderVerification
xs
@
[
a
,
b
]
|
a
<=
b
=
return
xs
|
otherwise
=
Ex
.
throw
$
Ex
.
AssertionFailed
"The first index should be smaller than the second"
rangeSliderVerification
_
=
Ex
.
throw
$
Ex
.
AssertionFailed
"There should be two indices"
-- | Store a numeric value, with verification mechanism for its range.
-- | Store a numeric value, with verification mechanism for its range.
ranged
::
(
SingI
f
,
Num
(
FieldType
f
),
Ord
(
FieldType
f
),
Typeable
(
FieldType
f
))
ranged
::
(
SingI
f
,
Num
(
FieldType
f
),
Ord
(
FieldType
f
),
Typeable
(
FieldType
f
))
=>
Sing
f
->
(
FieldType
f
,
FieldType
f
)
->
AttrVal
(
FieldType
f
)
->
Attr
f
=>
Sing
f
->
(
FieldType
f
,
FieldType
f
)
->
AttrVal
(
FieldType
f
)
->
Attr
f
...
...
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