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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
purescript-gargantext
Commits
56bc0149
Commit
56bc0149
authored
Jun 14, 2022
by
Przemyslaw Kaminski
Committed by
Karen Konou
Jun 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ngramsTable] WIP
parent
a605dc66
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
180 additions
and
96 deletions
+180
-96
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+120
-70
Components.purs
src/Gargantext/Components/NgramsTable/Components.purs
+26
-16
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+2
-0
Tabs.purs
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
+14
-6
Tabs.purs
...gantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
+9
-2
Tabs.purs
src/Gargantext/Components/Nodes/Lists/Tabs.purs
+9
-2
No files found.
src/Gargantext/Components/NgramsTable.purs
View file @
56bc0149
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/NgramsTable/Components.purs
View file @
56bc0149
...
@@ -11,6 +11,8 @@ import Data.Nullable (null, toMaybe)
...
@@ -11,6 +11,8 @@ import Data.Nullable (null, toMaybe)
import Data.Set (Set)
import Data.Set (Set)
import Data.Set as Set
import Data.Set as Set
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import FFI.Simple (delay)
import FFI.Simple (delay)
import Gargantext.Components.NgramsTable.Core (Action(..), Dispatch, NgramsClick, NgramsDepth, NgramsElement, NgramsTable, NgramsTablePatch, NgramsTerm, _NgramsElement, _NgramsRepoElement, _PatchMap, _children, _list, _ngrams, _occurrences, ngramsTermText, replace, setTermListA)
import Gargantext.Components.NgramsTable.Core (Action(..), Dispatch, NgramsClick, NgramsDepth, NgramsElement, NgramsTable, NgramsTablePatch, NgramsTerm, _NgramsElement, _NgramsRepoElement, _PatchMap, _children, _list, _ngrams, _occurrences, ngramsTermText, replace, setTermListA)
import Gargantext.Components.Table as Tbl
import Gargantext.Components.Table as Tbl
...
@@ -118,11 +120,12 @@ selectionCheckboxCpt = here.component "selectionCheckbox" cpt
...
@@ -118,11 +120,12 @@ selectionCheckboxCpt = here.component "selectionCheckbox" cpt
type RenderNgramsTree =
type RenderNgramsTree =
( ngramsChildren :: List NgramsTerm
( getNgramsChildren :: NgramsTerm -> Aff (Array NgramsTerm)
, ngramsClick :: NgramsClick
, ngramsChildren :: List NgramsTerm
, ngramsDepth :: NgramsDepth
, ngramsClick :: NgramsClick
, ngramsEdit :: NgramsClick
, ngramsDepth :: NgramsDepth
, ngramsStyle :: Array DOM.Props
, ngramsEdit :: NgramsClick
, ngramsStyle :: Array DOM.Props
--, ngramsTable :: NgramsTable
--, ngramsTable :: NgramsTable
)
)
...
@@ -131,11 +134,12 @@ renderNgramsTree p = R.createElement renderNgramsTreeCpt p []
...
@@ -131,11 +134,12 @@ renderNgramsTree p = R.createElement renderNgramsTreeCpt p []
renderNgramsTreeCpt :: R.Component RenderNgramsTree
renderNgramsTreeCpt :: R.Component RenderNgramsTree
renderNgramsTreeCpt = here.component "renderNgramsTree" cpt
renderNgramsTreeCpt = here.component "renderNgramsTree" cpt
where
where
cpt { ngramsChildren, ngramsClick, ngramsDepth, ngramsEdit, ngramsStyle } _ =
cpt {
getNgramsChildren,
ngramsChildren, ngramsClick, ngramsDepth, ngramsEdit, ngramsStyle } _ =
pure $ H.ul {}
pure $ H.ul {}
[ H.span { className: "tree" }
[ H.span { className: "tree" }
[ H.span { className: "righthanded" }
[ H.span { className: "righthanded" }
[ tree { ngramsChildren
[ tree { getNgramsChildren
, ngramsChildren
, ngramsClick
, ngramsClick
, ngramsDepth
, ngramsDepth
, ngramsEdit
, ngramsEdit
...
@@ -163,8 +167,9 @@ tag tagProps =
...
@@ -163,8 +167,9 @@ tag tagProps =
-}
-}
type TreeProps =
type TreeProps =
( ngramsChildren :: List NgramsTerm
( getNgramsChildren :: NgramsTerm -> Aff (Array NgramsTerm)
, ngramsEdit :: NgramsClick
, ngramsChildren :: List NgramsTerm
, ngramsEdit :: NgramsClick
--, ngramsTable :: NgramsTable
--, ngramsTable :: NgramsTable
| TagProps
| TagProps
)
)
...
@@ -174,11 +179,13 @@ tree p = R.createElement treeCpt p []
...
@@ -174,11 +179,13 @@ tree p = R.createElement treeCpt p []
treeCpt :: R.Component TreeProps
treeCpt :: R.Component TreeProps
treeCpt = here.component "tree" cpt
treeCpt = here.component "tree" cpt
where
where
cpt params@{ ngramsChildren, ngramsClick, ngramsDepth, ngramsEdit, ngramsStyle } _ = do
cpt params@{ getNgramsChildren, ngramsChildren, ngramsClick, ngramsDepth, ngramsEdit, ngramsStyle } _ = do
R.useEffect' $ do
R.useEffect' $ do
here.log2 "[tree] ngramsChildren" ngramsChildren
launchAff_ $ do
c <- getNgramsChildren ngramsDepth.ngrams
liftEffect $ here.log2 "[tree] ngrams" ngramsDepth.ngrams
liftEffect $ here.log2 "[tree] children" c
pure $
pure $
H.li { style: { width : "100%" } }
H.li { style: { width : "100%" } }
([ H.i { className, style } [] ]
([ H.i { className, style } [] ]
...
@@ -212,8 +219,9 @@ treeCpt = here.component "tree" cpt
...
@@ -212,8 +219,9 @@ treeCpt = here.component "tree" cpt
H.ul {} <<< map (\ngrams -> tree (params { ngramsDepth = {depth, ngrams} })) <<< L.toUnfoldable
H.ul {} <<< map (\ngrams -> tree (params { ngramsDepth = {depth, ngrams} })) <<< L.toUnfoldable
type RenderNgramsItem = (
type RenderNgramsItem =
dispatch :: Action -> Effect Unit
( dispatch :: Action -> Effect Unit
, getNgramsChildren :: NgramsTerm -> Aff (Array NgramsTerm)
, ngrams :: NgramsTerm
, ngrams :: NgramsTerm
, ngramsElement :: NgramsElement
, ngramsElement :: NgramsElement
, ngramsLocalPatch :: NgramsTablePatch
, ngramsLocalPatch :: NgramsTablePatch
...
@@ -228,6 +236,7 @@ renderNgramsItemCpt :: R.Component RenderNgramsItem
...
@@ -228,6 +236,7 @@ renderNgramsItemCpt :: R.Component RenderNgramsItem
renderNgramsItemCpt = here.component "renderNgramsItem" cpt
renderNgramsItemCpt = here.component "renderNgramsItem" cpt
where
where
cpt { dispatch
cpt { dispatch
, getNgramsChildren
, ngrams
, ngrams
, ngramsElement
, ngramsElement
, ngramsLocalPatch
, ngramsLocalPatch
...
@@ -245,7 +254,8 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
...
@@ -245,7 +254,8 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
, checkbox GT.StopTerm
, checkbox GT.StopTerm
, H.div {}
, H.div {}
( if ngramsParent == Nothing
( if ngramsParent == Nothing
then [renderNgramsTree { ngramsChildren
then [renderNgramsTree { getNgramsChildren
, ngramsChildren
, ngramsClick
, ngramsClick
, ngramsDepth
, ngramsDepth
, ngramsEdit
, ngramsEdit
...
...
src/Gargantext/Components/NgramsTable/Core.purs
View file @
56bc0149
...
@@ -80,6 +80,7 @@ module Gargantext.Components.NgramsTable.Core
...
@@ -80,6 +80,7 @@ module Gargantext.Components.NgramsTable.Core
, NgramsDepth
, NgramsDepth
, NgramsClick
, NgramsClick
, NgramsActionRef
)
)
where
where
...
@@ -1197,3 +1198,4 @@ postNgramsChartsAsync { listIds, nodeId, session, tabType } = do
...
@@ -1197,3 +1198,4 @@ postNgramsChartsAsync { listIds, nodeId, session, tabType } = do
type NgramsDepth = { ngrams :: NgramsTerm, depth :: Int }
type NgramsDepth = { ngrams :: NgramsTerm, depth :: Int }
type NgramsClick = NgramsDepth -> Maybe (Effect Unit)
type NgramsClick = NgramsDepth -> Maybe (Effect Unit)
type NgramsActionRef = R.Ref (Maybe (Unit -> Effect Unit))
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
View file @
56bc0149
...
@@ -113,22 +113,30 @@ ngramsViewCpt = here.component "ngramsView" cpt where
...
@@ -113,22 +113,30 @@ ngramsViewCpt = here.component "ngramsView" cpt where
NTC.initialPageParams session nodeId
NTC.initialPageParams session nodeId
[ defaultListId ] (TabDocument TabDocs)
[ defaultListId ] (TabDocument TabDocs)
treeEdit <- T.useBox NT.initialTreeEdit
onCancelRef <- R.useRef Nothing
onNgramsClickRef <- R.useRef Nothing
onSaveRef <- R.useRef Nothing
treeEditBox <- T.useBox NT.initialTreeEdit
pure $ NT.mainNgramsTable (props' treeEdit path) []
let most = RX.pick props :: Record NTCommon
where
props' =
most = RX.pick props :: Record NTCommon
props' treeEdit path =
(Record.merge most
(Record.merge most
{ afterSync
{ afterSync
, path
, path
, tabType: TabPairing (TabNgramType $ modeTabType mode)
, tabType: TabPairing (TabNgramType $ modeTabType mode)
, tabNgramType: modeTabType' mode
, tabNgramType: modeTabType' mode
, treeEdit
, treeEdit: { box: treeEditBox
, getNgramsChildren: \_ -> pure []
, onCancelRef
, onNgramsClickRef
, onSaveRef }
, withAutoUpdate: false }) :: Record NT.MainNgramsTableProps
, withAutoUpdate: false }) :: Record NT.MainNgramsTableProps
afterSync :: Unit -> Aff Unit
afterSync :: Unit -> Aff Unit
afterSync _ = pure unit
afterSync _ = pure unit
pure $ NT.mainNgramsTable props' []
type NTCommon =
type NTCommon =
( boxes :: Boxes
( boxes :: Boxes
, cacheState :: T.Box LTypes.CacheState
, cacheState :: T.Box LTypes.CacheState
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
View file @
56bc0149
...
@@ -146,7 +146,10 @@ ngramsViewCpt = here.component "ngramsView" cpt
...
@@ -146,7 +146,10 @@ ngramsViewCpt = here.component "ngramsView" cpt
, nodeId
, nodeId
, session } _ = do
, session } _ = do
path <- T.useBox $ NTC.initialPageParams session nodeId [defaultListId] (TabDocument TabDocs)
path <- T.useBox $ NTC.initialPageParams session nodeId [defaultListId] (TabDocument TabDocs)
treeEdit <- T.useBox NT.initialTreeEdit
onCancelRef <- R.useRef Nothing
onNgramsClickRef <- R.useRef Nothing
onSaveRef <- R.useRef Nothing
treeEditBox <- T.useBox NT.initialTreeEdit
pure $ NT.mainNgramsTable {
pure $ NT.mainNgramsTable {
afterSync: \_ -> pure unit
afterSync: \_ -> pure unit
...
@@ -157,7 +160,11 @@ ngramsViewCpt = here.component "ngramsView" cpt
...
@@ -157,7 +160,11 @@ ngramsViewCpt = here.component "ngramsView" cpt
, session
, session
, tabNgramType
, tabNgramType
, tabType
, tabType
, treeEdit
, treeEdit: { box: treeEditBox
, getNgramsChildren: \_ -> pure []
, onCancelRef
, onNgramsClickRef
, onSaveRef }
, withAutoUpdate: false
, withAutoUpdate: false
} []
} []
where
where
...
...
src/Gargantext/Components/Nodes/Lists/Tabs.purs
View file @
56bc0149
...
@@ -89,7 +89,10 @@ ngramsViewCpt = here.component "ngramsView" cpt where
...
@@ -89,7 +89,10 @@ ngramsViewCpt = here.component "ngramsView" cpt where
, session
, session
, path } _ = do
, path } _ = do
chartsReload <- T.useBox T2.newReload
chartsReload <- T.useBox T2.newReload
treeEdit <- T.useBox NT.initialTreeEdit
onCancelRef <- R.useRef Nothing
onNgramsClickRef <- R.useRef Nothing
onSaveRef <- R.useRef Nothing
treeEditBox <- T.useBox NT.initialTreeEdit
{ listIds, nodeId, params } <- T.useLive T.unequal path
{ listIds, nodeId, params } <- T.useLive T.unequal path
...
@@ -115,7 +118,11 @@ ngramsViewCpt = here.component "ngramsView" cpt where
...
@@ -115,7 +118,11 @@ ngramsViewCpt = here.component "ngramsView" cpt where
, session
, session
, tabNgramType
, tabNgramType
, tabType
, tabType
, treeEdit
, treeEdit: { box: treeEditBox
, getNgramsChildren: \_ -> pure []
, onCancelRef
, onNgramsClickRef
, onSaveRef }
, withAutoUpdate: false
, withAutoUpdate: false
} []
} []
]
]
...
...
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