Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
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
Grégoire Locqueville
purescript-gargantext
Commits
d9a30f18
Commit
d9a30f18
authored
Aug 20, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Reactix] R2.StateSetter type
parent
ba207d95
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
AnnotatedField.purs
src/Gargantext/Components/Annotation/AnnotatedField.purs
+2
-1
ContextMenu.purs
src/Gargantext/Components/ContextMenu/ContextMenu.purs
+4
-4
No files found.
src/Gargantext/Components/Annotation/AnnotatedField.purs
View file @
d9a30f18
...
@@ -31,6 +31,7 @@ import Gargantext.Types ( TermList )
...
@@ -31,6 +31,7 @@ import Gargantext.Types ( TermList )
import Gargantext.Components.Annotation.Utils ( termBootstrapClass )
import Gargantext.Components.Annotation.Utils ( termBootstrapClass )
import Gargantext.Components.NgramsTable.Core ( NgramsTerm, NgramsTable(..), _NgramsElement, _list, highlightNgrams, findNgramTermList )
import Gargantext.Components.NgramsTable.Core ( NgramsTerm, NgramsTable(..), _NgramsElement, _list, highlightNgrams, findNgramTermList )
import Gargantext.Components.Annotation.Menu ( AnnotationMenu, annotationMenu, MenuType(..) )
import Gargantext.Components.Annotation.Menu ( AnnotationMenu, annotationMenu, MenuType(..) )
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Selection as Sel
import Gargantext.Utils.Selection as Sel
type Props =
type Props =
...
@@ -90,7 +91,7 @@ maybeShowMenu setMenu setTermList ngrams event = do
...
@@ -90,7 +91,7 @@ maybeShowMenu setMenu setTermList ngrams event = do
Nothing -> pure unit
Nothing -> pure unit
maybeAddMenu
maybeAddMenu
::
((Maybe AnnotationMenu -> Maybe AnnotationMenu) -> Effect Unit
)
::
R2.StateSetter (Maybe AnnotationMenu
)
-> R.Element
-> R.Element
-> Maybe AnnotationMenu
-> Maybe AnnotationMenu
-> R.Element
-> R.Element
...
...
src/Gargantext/Components/ContextMenu/ContextMenu.purs
View file @
d9a30f18
...
@@ -26,7 +26,7 @@ import Reactix.SyntheticEvent as E
...
@@ -26,7 +26,7 @@ import Reactix.SyntheticEvent as E
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
type Props t = ( x :: Number, y :: Number, setMenu ::
(Maybe t -> Maybe t) -> Effect Unit
)
type Props t = ( x :: Number, y :: Number, setMenu ::
R2.StateSetter (Maybe t)
)
getPortalHost :: R.Hooks DOM.Element
getPortalHost :: R.Hooks DOM.Element
getPortalHost = R.unsafeHooksEffect $ delay unit $ \_ -> pure $ document ... "getElementById" $ ["menu-portal"]
getPortalHost = R.unsafeHooksEffect $ delay unit $ \_ -> pure $ document ... "getElementById" $ ["menu-portal"]
...
@@ -70,7 +70,7 @@ contextMenuCpt = R.hooksComponent "ContextMenu" cpt
...
@@ -70,7 +70,7 @@ contextMenuCpt = R.hooksComponent "ContextMenu" cpt
contextMenuEffect
contextMenuEffect
:: forall t
:: forall t
.
((Maybe t -> Maybe t) -> Effect Uni
t)
.
R2.StateSetter (Maybe
t)
-> R.Ref (Nullable DOM.Element)
-> R.Ref (Nullable DOM.Element)
-> Effect (Effect Unit)
-> Effect (Effect Unit)
contextMenuEffect setMenu rootRef =
contextMenuEffect setMenu rootRef =
...
@@ -85,14 +85,14 @@ contextMenuEffect setMenu rootRef =
...
@@ -85,14 +85,14 @@ contextMenuEffect setMenu rootRef =
DOM.removeEventListener document "scroll" onScroll
DOM.removeEventListener document "scroll" onScroll
Nothing -> pure R.nothing
Nothing -> pure R.nothing
documentClickHandler :: forall t.
((Maybe t -> Maybe t) -> Effect Uni
t) -> DOM.Element -> Callback DE.MouseEvent
documentClickHandler :: forall t.
R2.StateSetter (Maybe
t) -> DOM.Element -> Callback DE.MouseEvent
documentClickHandler hide menu =
documentClickHandler hide menu =
R2.named "hideMenuOnClickOutside" $ callback $ \e ->
R2.named "hideMenuOnClickOutside" $ callback $ \e ->
if Element.contains menu (DE.target e)
if Element.contains menu (DE.target e)
then pure unit
then pure unit
else hide (const Nothing)
else hide (const Nothing)
documentScrollHandler :: forall t.
((Maybe t -> Maybe t) -> Effect Uni
t) -> Callback DE.MouseEvent
documentScrollHandler :: forall t.
R2.StateSetter (Maybe
t) -> Callback DE.MouseEvent
documentScrollHandler hide =
documentScrollHandler hide =
R2.named "hideMenuOnScroll" $ callback $ \e -> hide (const Nothing)
R2.named "hideMenuOnScroll" $ callback $ \e -> hide (const Nothing)
...
...
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