ywana-core8 0.0.477 → 0.0.478

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.477",
3
+ "version": "0.0.478",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -15,7 +15,18 @@ import "./CollectionPage.css"
15
15
  export const CollectionPage = (props) => {
16
16
 
17
17
  const site = useContext(SiteContext)
18
- const { id = "collection", icon, title, name = "Collection 1", schema, url, field, host, page, fetching= false, groupBy, editor, autosave = false, delay = 1000, actions, levels, onSelect, children } = props
18
+ const {
19
+ id = "collection",
20
+ icon, title, name = "Collection 1",
21
+ schema, url, field, host, page, fetching= false,
22
+ actions = [], onSelect,
23
+ canFilter = false, canAdd = false, canDelete = false, canEdit = false,
24
+ autosave = false, delay = 1000,
25
+ groupBy, levels,
26
+ editor,
27
+ children
28
+ } = props
29
+
19
30
  const [pageContext, setPageContext] = useContext(PageContext)
20
31
  const context = CollectionContext(url, field, host, page, fetching)
21
32
 
@@ -48,13 +59,15 @@ export const CollectionPage = (props) => {
48
59
  return (
49
60
  <Fragment>
50
61
  <Header className="collection-page" title={<Text>{title}</Text>}>
51
- <Button icon="add" label="Add" action={add} />
62
+ { canAdd ? <Button icon="add" label="Add" action={add} /> : false }
63
+ &nbsp;
52
64
  <Button icon="refresh" label="Reload" action={reload} />
53
65
  {renderActions()}
54
66
  </Header>
55
67
  <menu className="collection-page">
56
68
  <Header title={<Text>Lista de {name}</Text>} >
57
69
  </Header>
70
+ {canFilter ? <CollectionFilters schema={schema}/> : null }
58
71
  {levels ? <CollectionTree levels={levels} onSelect={onSelect}/> : <CollectionList groupBy={groupBy} onSelect={onSelect}/>}
59
72
  </menu>
60
73
  <main key={id} className="collection-page">
@@ -65,6 +78,20 @@ export const CollectionPage = (props) => {
65
78
  )
66
79
  }
67
80
 
81
+ /**
82
+ * Collection Filters
83
+ */
84
+ const CollectionFilters = (props) => {
85
+
86
+ const { schema } = props
87
+
88
+ return (
89
+ <div className="collection-filters">
90
+ TODO: filters
91
+ </div>
92
+ )
93
+ }
94
+
68
95
  /**
69
96
  * Collection List
70
97
  */
@@ -88,7 +115,7 @@ const CollectionList = (props) => {
88
115
 
89
116
  const items = all ? all.map(content => ({
90
117
  id: content.id,
91
- line1: content.name,
118
+ line1: content.name || content.centre, // centre: Signflow legacy
92
119
  line2: content.description,
93
120
  content
94
121
  })) : []