ywana-core8 0.0.618 → 0.0.621

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.618",
3
+ "version": "0.0.621",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -79,7 +79,7 @@ export const CollectionPage = (props) => {
79
79
  </Header>
80
80
  <menu className={`collection-page ${className}`}>
81
81
  <Header title={<Text>{name}</Text>} >
82
- { canFilter ? showFilter ? <Icon icon="filter_list" size="small" clickable action={toggleFilters} /> : <Icon icon="filter_list_off" size="small" clickable action={toggleFilters} /> : false }
82
+ {canFilter ? showFilter ? <Icon icon="filter_list" size="small" clickable action={toggleFilters} /> : <Icon icon="filter_list_off" size="small" clickable action={toggleFilters} /> : false}
83
83
  </Header>
84
84
  {canFilter && showFilter ? <CollectionFilters schema={schema} /> : null}
85
85
  {levels ? <CollectionTree schema={schema} icon={icon} levels={levels} onSelect={onSelect} sorter={sorter} searchBy={searchBy} /> : <CollectionList groupBy={groupBy} onSelect={onSelect} searchBy={searchBy} />}
@@ -229,14 +229,18 @@ export const CollectionTree = (props) => {
229
229
 
230
230
  function group(items, by) {
231
231
 
232
- console.log(schema, items, by)
233
232
  const options = schema[by] ? schema[by].options : null
234
233
 
235
234
  return items.reduce((nodes, field) => {
236
235
  let node = nodes.find(n => n.name === field[by])
237
236
  if (!node) {
238
- let name = options ? options.find(option => option.value === field[by]) : field[by]
239
- node = { name, items: [], field: by }
237
+ let name = field[by]
238
+ let title = field[by]
239
+ if (options) {
240
+ const opt = options.find(option => option.value === field[by])
241
+ if (opt) title = opt.label
242
+ }
243
+ node = { name, items: [], field: by, title }
240
244
  nodes.push(node)
241
245
  }
242
246
  node.items.push(field)
@@ -253,7 +257,7 @@ export const CollectionTree = (props) => {
253
257
 
254
258
  function renderNodes(nodes) {
255
259
  return nodes.map(node => {
256
- const title = typeof node.name === 'boolean' ? `${node.field} = ${node.name}` : node.name
260
+ const title = typeof node.name === 'boolean' ? `${node.field} = ${node.name}` : node.title
257
261
  return (
258
262
  <TreeNode key={node.name} icon={null} label={title} open={true}>
259
263
  {node.nodes ? renderNodes(node.nodes) : node.items.map(item => {
@@ -385,7 +389,7 @@ export const CollectionContext = (url, field, host, page, fetching) => {
385
389
  changeFilters(filters) {
386
390
  this.filters = filters
387
391
  },
388
-
392
+
389
393
  async load() {
390
394
  try {
391
395
  const data = await API.all(null, page);
@@ -1,5 +1,6 @@
1
1
  import React from 'react'
2
2
  import { Icon } from './icon'
3
+ import { Text } from './text'
3
4
  import './button.css'
4
5
 
5
6
  /**
@@ -20,7 +21,7 @@ export const Button = ({ label, icon, action, disabled = false, outlined, raised
20
21
  return (
21
22
  <button className={`btn ${style}`} onClick={click}>
22
23
  { icon ? <Icon icon={icon} size="small" clickable action={click} /> : null }
23
- <span>{ label }</span>
24
+ <Text>{ label }</Text>
24
25
  </button>
25
26
  )
26
27
  }