ywana-core8 0.0.255 → 0.0.256

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.255",
3
+ "version": "0.0.256",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -18,7 +18,7 @@ const http = HTTPClient(window.API || process.env.REACT_APP_API, Session);
18
18
  export const CollectionPage = (props) => {
19
19
 
20
20
  const site = useContext(SiteContext)
21
- const { id = "collection", icon, title, name = "Collection 1", schema, url, groupBy, editor, field, autosave = false, delay = 1000, actions, levels } = props
21
+ const { id = "collection", icon, title, name = "Collection 1", schema, url, groupBy, editor, field, autosave = false, delay = 1000, actions, levels, onSelect } = props
22
22
  const [pageContext, setPageContext] = useContext(PageContext)
23
23
  const context = CollectionContext(url, field)
24
24
 
@@ -58,7 +58,7 @@ export const CollectionPage = (props) => {
58
58
  <menu className="collection-page">
59
59
  <Header title={<Text>Lista de {name}</Text>} >
60
60
  </Header>
61
- {levels ? <CollectionTree levels={levels} /> : <CollectionList groupBy={groupBy} />}
61
+ {levels ? <CollectionTree levels={levels} onSelect={onSelect}/> : <CollectionList groupBy={groupBy} onSelect={onSelect}/>}
62
62
  </menu>
63
63
  <main key={id} className="collection-page">
64
64
  <CollectionEditor icon={icon} schema={schema} layout={editor} autosave={autosave} delay={delay} />
@@ -72,7 +72,7 @@ export const CollectionPage = (props) => {
72
72
  */
73
73
  const CollectionList = (props) => {
74
74
 
75
- const { groupBy } = props
75
+ const { groupBy, onSelect } = props
76
76
  const [pageContext, setPageContext] = useContext(PageContext)
77
77
  const { all = [] } = pageContext
78
78
 
@@ -85,6 +85,7 @@ const CollectionList = (props) => {
85
85
  clear()
86
86
  await pageContext.select(id)
87
87
  setPageContext(Object.assign({}, pageContext))
88
+ if (onSelect) onSelect(id)
88
89
  }
89
90
 
90
91
  const items = all ? all.map(content => ({
@@ -104,7 +105,7 @@ const CollectionList = (props) => {
104
105
  */
105
106
  const CollectionTree = (props) => {
106
107
 
107
- const { levels } = props
108
+ const { levels, onSelect } = props
108
109
  const [pageContext, setPageContext] = useContext(PageContext)
109
110
  const { all = [] } = pageContext
110
111
 
@@ -117,6 +118,7 @@ const CollectionTree = (props) => {
117
118
  clear()
118
119
  await pageContext.select(id)
119
120
  setPageContext(Object.assign({}, pageContext))
121
+ if (onSelect) onSelect(id)
120
122
  }
121
123
 
122
124
  function group(items, by) {