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
bab9f124
Commit
bab9f124
authored
Aug 25, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[search] some refactorings for search input box
parent
39a3fdef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
51 deletions
+84
-51
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+45
-24
Components.purs
src/Gargantext/Components/NgramsTable/Components.purs
+39
-27
No files found.
src/Gargantext/Components/NgramsTable.purs
View file @
bab9f124
...
...
@@ -273,6 +273,33 @@ loadedNgramsTable :: R2.Component PropsNoReload
loadedNgramsTable = R.createElement loadedNgramsTableCpt
loadedNgramsTableCpt :: R.Component PropsNoReload
loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
cpt props@{ path } _ = do
searchQuery <- T.useFocused (_.searchQuery) (\a b -> b { searchQuery = a }) path
pure $ R.fragment $
[ loadedNgramsTableHeader { searchQuery } []
, loadedNgramsTableBody props [] ]
type LoadedNgramsTableHeaderProps =
( searchQuery :: T.Box SearchQuery )
loadedNgramsTableHeader :: R2.Component LoadedNgramsTableHeaderProps
loadedNgramsTableHeader = R.createElement loadedNgramsTableHeaderCpt
loadedNgramsTableHeaderCpt :: R.Component LoadedNgramsTableHeaderProps
loadedNgramsTableHeaderCpt = here.component "loadedNgramsTableHeader" cpt where
cpt { searchQuery } _ = do
pure $ R.fragment
[ H.h4 {style: {textAlign : "center"}}
[ H.span {className: "fa fa-hand-o-down"} []
, H.text "Extracted Terms" ]
, NTC.searchInput { key: "search-input"
, searchQuery }
]
loadedNgramsTableBody :: R2.Component PropsNoReload
loadedNgramsTableBody = R.createElement loadedNgramsTableBodyCpt
loadedNgramsTableBodyCpt :: R.Component PropsNoReload
loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
cpt { afterSync
, boxes: { errors
, tasks }
...
...
@@ -370,31 +397,25 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
<<< _Just
) =<< ngramsParent
pure $ R.fragment $
autoUpdate path' <>
[ H.h4 {style: {textAlign : "center"}}
[ H.span {className: "fa fa-hand-o-down"} []
, H.text "Extracted Terms" ]
, NTC.searchInput { key: "search-input"
, searchQuery }
, TT.table
{ colNames
, container: tableContainer
{ dispatch: performAction
, ngramsChildren
, ngramsParent
, ngramsSelection
, ngramsTable
, path
, syncResetButton: [ syncResetButton ]
, tabNgramType }
, params
, rows: filteredConvertedRows
pure $ R.fragment
[ TT.table
{ colNames
, container: tableContainer
{ dispatch: performAction
, ngramsChildren
, ngramsParent
, ngramsSelection
, ngramsTable
, path
, syncResetButton: [ syncResetButton ]
, totalRecords
, wrapColElts:
wrapColElts { allNgramsSelected, dispatch: performAction, ngramsSelection } scoreType
}
, tabNgramType }
, params
, rows: filteredConvertedRows
, syncResetButton: [ syncResetButton ]
, totalRecords
, wrapColElts:
wrapColElts { allNgramsSelected, dispatch: performAction, ngramsSelection } scoreType
}
, syncResetButton
]
where
...
...
src/Gargantext/Components/NgramsTable/Components.purs
View file @
bab9f124
...
...
@@ -25,7 +25,6 @@ import Gargantext.Components.NgramsTable.Core
( Action(..), Dispatch, NgramsElement, NgramsTable, NgramsTablePatch, NgramsTerm
, _NgramsElement, _NgramsRepoElement, _PatchMap, _children, _list
, _ngrams, _occurrences, ngramsTermText, replace, setTermListA )
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Table as Tbl
import Gargantext.Types as T
import Gargantext.Utils.Reactix as R2
...
...
@@ -38,44 +37,57 @@ type SearchInputProps =
, searchQuery :: T.Box String
)
searchInput :: R
ecord SearchInputProps -> R.Element
searchInput :: R
2.Leaf SearchInputProps
searchInput props = R.createElement searchInputCpt props []
searchInputCpt :: R.Component SearchInputProps
searchInputCpt = here.component "searchInput" cpt
where
cpt { searchQuery } _ = do
searchQuery' <- T.useLive T.unequal searchQuery
pure $ R2.row [
H.div { className: "col-12" } [
H.div { className: "input-group" }
[ searchButton
searchQuery'
,
fieldInput searchQuery'
[ searchButton
{ searchQuery } []
,
searchFieldInput { searchQuery } []
]
]
]
where
searchButton searchQuery' =
H.div { className: "input-group-prepend" }
[ if searchQuery' /= ""
then removeButton
else H.span { className: "fa fa-search input-group-text" } []
]
removeButton =
H.button { className: "btn btn-danger"
, on: {click: \e -> T.write "" searchQuery}}
[ H.span {className: "fa fa-times"} []]
fieldInput searchQuery' =
H.input { className: "form-control"
, defaultValue: searchQuery'
, name: "search"
, on: { input: \e -> T.write (R.unsafeEventValue e) searchQuery }
, placeholder: "Search"
, type: "value"
}
type SearchButtonProps =
( searchQuery :: T.Box String
)
searchButton :: R2.Component SearchButtonProps
searchButton = R.createElement searchButtonCpt
searchButtonCpt :: R.Component SearchButtonProps
searchButtonCpt = here.component "searchButton" cpt where
cpt { searchQuery } _ = do
searchQuery' <- T.useLive T.unequal searchQuery
pure $ H.div { className: "input-group-prepend" }
[ if searchQuery' /= ""
then
H.button { className: "btn btn-danger"
, on: {click: \_ -> T.write "" searchQuery}}
[ H.span {className: "fa fa-times"} []]
else H.span { className: "fa fa-search input-group-text" } []
]
type SearchFieldInputProps =
( searchQuery :: T.Box String
)
searchFieldInput :: R2.Component SearchFieldInputProps
searchFieldInput = R.createElement searchFieldInputCpt
searchFieldInputCpt :: R.Component SearchFieldInputProps
searchFieldInputCpt = here.component "searchFieldInput" cpt where
cpt { searchQuery } _ = do
pure $ H.input { className: "form-control"
, name: "search"
, on: { input: \e -> T.write (R.unsafeEventValue e) searchQuery }
, placeholder: "Search"
, type: "value"
}
type SelectionCheckboxProps =
( allNgramsSelected :: Boolean
, dispatch :: Dispatch
...
...
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