ywana-core8 0.0.743 → 0.0.744

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.743",
3
+ "version": "0.0.744",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -5,7 +5,7 @@ import { SiteContext } from '../site/siteContext'
5
5
  import { Button, Header, Icon, List, Menu, MenuIcon, MenuItem, Text, Tree, TreeItem, TreeNode, TextField, Chip, Tooltip } from '../html'
6
6
  import { ContentEditor, TabbedContentEditor, TreededContentEditor } from './ContentEditor'
7
7
  import { CreateContentDialog } from './CreateContentDialog'
8
- import { CollectionAPI } from './CollectionAPI'
8
+ import { CollectionAPI } from './CollectionAPI'
9
9
  import { Content, TYPES } from './ContentType'
10
10
  import "./CollectionPage.css"
11
11
 
@@ -24,6 +24,7 @@ export const CollectionPage = (props) => {
24
24
  autosave = false, delay = 1000, patch = false, versioning = false,
25
25
  groupBy, levels, sorter, namer,
26
26
  editor, editorTitle, editorActions,
27
+ listItemRenderer,
27
28
  filters,
28
29
  footer,
29
30
  children
@@ -80,10 +81,10 @@ export const CollectionPage = (props) => {
80
81
  </Header>
81
82
  <menu className={`collection-page ${className} ${hiddenStyle}`}>
82
83
  {canFilter ? <CollectionFilters schema={schema} initial={filters} /> : null}
83
- {levels ? <CollectionTree schema={schema} icon={icon} levels={levels} onSelect={onSelect} sorter={sorter} searchBy={searchBy} namer={namer} /> : <CollectionList groupBy={groupBy} onSelect={onSelect} searchBy={searchBy} />}
84
+ {levels ? <CollectionTree schema={schema} icon={icon} levels={levels} onSelect={onSelect} sorter={sorter} searchBy={searchBy} namer={namer} /> : <CollectionList groupBy={groupBy} onSelect={onSelect} searchBy={searchBy} itemRenderer={listItemRenderer} />}
84
85
  </menu>
85
86
  <main key={id} className={`collection-page ${className}`}>
86
- <CollectionEditor icon={icon} schema={schema} layout={editor} autosave={autosave} delay={delay} canDelete={canDelete} onReload={reloadSelection} patch={patch} onChange={onChange} actions={editorActions} title={editorTitle}/>
87
+ <CollectionEditor icon={icon} schema={schema} layout={editor} autosave={autosave} delay={delay} canDelete={canDelete} onReload={reloadSelection} patch={patch} onChange={onChange} actions={editorActions} title={editorTitle} />
87
88
  {children ? <article>{children}</article> : null}
88
89
  <footer>
89
90
  {footer}
@@ -165,7 +166,7 @@ const FilterResume = (props) => {
165
166
  {fields.length > 0 ? (
166
167
  <Tooltip text="Limpiar Filtros">
167
168
  <Icon icon="clear_all" size="small" clickable action={onClear} />
168
- </Tooltip>
169
+ </Tooltip>
169
170
  ) : null}
170
171
 
171
172
  <div className='filters-resume'>
@@ -188,7 +189,7 @@ const FilterResume = (props) => {
188
189
  */
189
190
  const CollectionList = (props) => {
190
191
 
191
- const { groupBy, onSelect, searchBy = [] } = props
192
+ const { groupBy, onSelect, searchBy = [], itemRenderer } = props
192
193
  const [pageContext, setPageContext] = useContext(PageContext)
193
194
  const { all = [] } = pageContext
194
195
  const [filter, setFilter] = useState()
@@ -221,18 +222,21 @@ const CollectionList = (props) => {
221
222
  }
222
223
 
223
224
  const items = search()
224
- const items2 = items.map(content => ({
225
- id: content.id,
226
- line1: content.name || content.centre || content.tag, // TODO: centres page Signflow legacy
227
- line2: content.description,
228
- grouper: content[groupBy],
229
- content,
230
- }))
225
+ const items2 = items.map(content => {
226
+ if (itemRenderer) return itemRenderer(content)
227
+ return {
228
+ id: content.id,
229
+ line1: content.name || content.centre || content.tag, // TODO: centres page Signflow legacy
230
+ line2: content.description,
231
+ grouper: content[groupBy],
232
+ content,
233
+ }
234
+ })
231
235
 
232
236
  return (
233
237
  <>
234
238
  <main>
235
- { groupBy ? <List items={items2} onSelect={select} groupBy="grouper" /> : <List items={items2} onSelect={select} /> }
239
+ {groupBy ? <List items={items2} onSelect={select} groupBy="grouper" /> : <List items={items2} onSelect={select} />}
236
240
  </main>
237
241
  <footer>
238
242
  <div className='search-box'>
@@ -397,7 +401,7 @@ const CollectionEditor = (props) => {
397
401
 
398
402
  function renderTitle() {
399
403
  if (title) {
400
- return typeof title === 'function' ? title(form) : title
404
+ return typeof title === 'function' ? title(form) : title
401
405
  } else {
402
406
  return selected ? selected.name : "New"
403
407
  }
@@ -406,7 +410,7 @@ const CollectionEditor = (props) => {
406
410
  function renderActions() {
407
411
  if (actions) {
408
412
  return actions.map(action => {
409
- // clone React action
413
+ // clone React action
410
414
  const action2 = React.cloneElement(action, { form })
411
415
  return action2
412
416
  })