ywana-core8 0.0.595 → 0.0.596

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.595",
3
+ "version": "0.0.596",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import { Property } from '../html'
3
- import { Content, TYPES } from './ContentType'
3
+ import { Content, FORMATS, TYPES } from './ContentType'
4
4
  import './ContentViewer.css'
5
5
 
6
6
  /**
@@ -48,11 +48,11 @@ const FieldViewer = (props) => {
48
48
  const { type, item, label, visible = true, optional } = field
49
49
 
50
50
  if (!visible) return null
51
- if (optional && value === undefined ) return null;
51
+ if (optional && value === undefined) return null;
52
52
 
53
53
  switch (type) {
54
54
  case TYPES.STRING:
55
- return <Property label={label} value={value} options={field.options}/>
55
+ return <StringViewer field={field} value={value} />
56
56
  case TYPES.ENTITY:
57
57
  return <EntityViewer field={field} value={value} />
58
58
  case TYPES.ARRAY:
@@ -83,6 +83,24 @@ const EntityViewer = (props) => {
83
83
  )
84
84
  }
85
85
 
86
+ /**
87
+ * StringViewer
88
+ */
89
+ const StringViewer = (props) => {
90
+ const { field, value } = props
91
+ const { id, format, label, options, editable = true, predictive = false, multivalue = false, Editor } = field
92
+ switch (format) {
93
+ case FORMATS.IMG:
94
+ return (
95
+ <div className='img-field'>
96
+ <img src={value} />
97
+ </div>
98
+ )
99
+ default:
100
+ return <Property label={label} value={value} options={options} />
101
+ }
102
+ }
103
+
86
104
 
87
105
  /**
88
106
  * Array Viewer
@@ -102,7 +120,7 @@ const ArrayViewer = (props) => {
102
120
  <tbody>
103
121
  {value.map(v => (
104
122
  <tr>
105
- { Object.keys(item).map(key => <td key={v[key]}>{v[key]}</td>) }
123
+ {Object.keys(item).map(key => <td key={v[key]}>{v[key]}</td>)}
106
124
  </tr>
107
125
  ))}
108
126
  </tbody>