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
af455fde
Commit
af455fde
authored
Oct 28, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into dev-graphql
parents
5356f9db
6dc2cbfe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
package.json
package.json
+1
-1
InputWithAutocomplete.purs
src/Gargantext/Components/InputWithAutocomplete.purs
+9
-8
No files found.
package.json
View file @
af455fde
{
{
"name"
:
"Gargantext"
,
"name"
:
"Gargantext"
,
"version"
:
"0.0.4.
5
"
,
"version"
:
"0.0.4.
6
"
,
"scripts"
:
{
"scripts"
:
{
"generate-purs-packages-nix"
:
"./nix/generate-purs-packages.nix"
,
"generate-purs-packages-nix"
:
"./nix/generate-purs-packages.nix"
,
"generate-psc-packages-nix"
:
"./nix/generate-packages-json.bash"
,
"generate-psc-packages-nix"
:
"./nix/generate-packages-json.bash"
,
...
...
src/Gargantext/Components/InputWithAutocomplete.purs
View file @
af455fde
...
@@ -3,13 +3,13 @@ module Gargantext.Components.InputWithAutocomplete where
...
@@ -3,13 +3,13 @@ module Gargantext.Components.InputWithAutocomplete where
import Prelude
import Prelude
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable, null, toMaybe)
import Data.Nullable (Nullable, null, toMaybe)
import Data.Tuple.Nested ((/\))
import DOM.Simple as DOM
import DOM.Simple as DOM
import DOM.Simple.Event as DE
import DOM.Simple.Event as DE
import Effect (Effect)
import Effect (Effect)
import Effect.Timer (setTimeout)
import Effect.Timer (setTimeout)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import React.SyntheticEvent as E
import Toestand as T
import Toestand as T
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
...
@@ -31,7 +31,6 @@ type Props =
...
@@ -31,7 +31,6 @@ type Props =
inputWithAutocomplete :: R2.Component Props
inputWithAutocomplete :: R2.Component Props
inputWithAutocomplete = R.createElement inputWithAutocompleteCpt
inputWithAutocomplete = R.createElement inputWithAutocompleteCpt
inputWithAutocompleteCpt :: R.Component Props
inputWithAutocompleteCpt :: R.Component Props
inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
where
where
...
@@ -44,7 +43,7 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
...
@@ -44,7 +43,7 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
inputRef <- R.useRef null
inputRef <- R.useRef null
completions <- T.useBox $ autocompleteSearch state'
completions <- T.useBox $ autocompleteSearch state'
let onFocus completions
e = T.write_ (autocompleteSearch state') completions
let onFocus completions
' _ = T.write_ (autocompleteSearch state') completions'
pure $
pure $
H.span { className: "input-with-autocomplete " <> classes }
H.span { className: "input-with-autocomplete " <> classes }
...
@@ -69,7 +68,7 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
...
@@ -69,7 +68,7 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
-- handles automatic autocomplete search, otherwise I'd have to hide it
-- handles automatic autocomplete search, otherwise I'd have to hide it
-- in various different places (i.e. carefully handle all possible
-- in various different places (i.e. carefully handle all possible
-- events where blur happens and autocomplete should hide).
-- events where blur happens and autocomplete should hide).
onBlur completions
e
= setTimeout 100 $ do
onBlur completions
_
= setTimeout 100 $ do
T.write_ [] completions
T.write_ [] completions
onInput completions e = do
onInput completions e = do
...
@@ -77,7 +76,7 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
...
@@ -77,7 +76,7 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
T.write_ val state
T.write_ val state
T.write_ (autocompleteSearch val) completions
T.write_ (autocompleteSearch val) completions
onInputKeyUp :: R.Ref (Nullable DOM.Element) -> DE.KeyboardEvent -> Effect
Unit
onInputKeyUp :: R.Ref (Nullable DOM.Element) -> DE.KeyboardEvent -> Effect
Boolean
onInputKeyUp inputRef e = do
onInputKeyUp inputRef e = do
if DE.key e == "Enter" then do
if DE.key e == "Enter" then do
let val = R.unsafeEventValue e
let val = R.unsafeEventValue e
...
@@ -85,10 +84,12 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
...
@@ -85,10 +84,12 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
T.write_ val state
T.write_ val state
onEnterPress val
onEnterPress val
case mInput of
case mInput of
Nothing -> pure unit
Nothing -> pure false
Just input -> R2.blur input
Just input -> do
R2.blur input
pure false
else
else
pure $
unit
pure $
false
type CompletionsProps =
type CompletionsProps =
( completions :: T.Box Completions
( completions :: T.Box Completions
...
...
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