ywana-core8 0.0.554 → 0.0.555

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.554",
3
+ "version": "0.0.555",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -52,7 +52,7 @@ const FieldViewer = (props) => {
52
52
 
53
53
  switch (type) {
54
54
  case TYPES.STRING:
55
- return <Property label={label} value={value} />
55
+ return <Property label={label} value={value} options={field.options}/>
56
56
  case TYPES.ENTITY:
57
57
  return <EntityViewer field={field} value={value} />
58
58
  case TYPES.ARRAY:
@@ -7,7 +7,7 @@ import './property.css'
7
7
  */
8
8
  export const Property = (props) => {
9
9
 
10
- const { id, className, label, name, initial, value, editable = false, onChange } = props
10
+ const { id, className, label, name, initial, value, editable = false, onChange, options } = props
11
11
 
12
12
  function change(event) {
13
13
  if (onChange) {
@@ -20,13 +20,19 @@ export const Property = (props) => {
20
20
  if (onChange) onChange(id, "")
21
21
  }
22
22
 
23
+ let value2 = value || initial
24
+
25
+ if (options) {
26
+ const opt = options.find(option => option.value == value2)
27
+ if (opt) value2 = opt.label
28
+ }
29
+
23
30
  return (
24
31
  <div className={`property property-${id} ${className}`}>
25
32
  <div className="property-name">{name || label}</div>
26
- { initial ? <div className='property-value'>{initial}</div> : null}
27
33
  <div className="property-value">
28
- {editable ? <input type="text" value={value} onChange={change}/> : value}
29
- {editable && value.length > 0 ? <Icon icon="close" size="small" clickable action={clear} /> : null }
34
+ {editable ? <input type="text" value={value2} onChange={change}/> : value2}
35
+ {editable && value2.length > 0 ? <Icon icon="close" size="small" clickable action={clear} /> : null }
30
36
  </div>
31
37
  </div>
32
38
  )