ywana-core8 0.0.72 → 0.0.73

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.72",
3
+ "version": "0.0.73",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -2,6 +2,7 @@ import React, { Fragment, useState } from 'react';
2
2
  import { Button, CheckBox, DataTable, DropDown, Icon, Stack, Tab, Tabs, Text, TextField, Tree, TreeNode, TreeItem, TokenField, Property } from '../html';
3
3
  import { Content, TYPES } from './ContentType';
4
4
  import './ContentEditor.css';
5
+ import { FORMATS } from '.';
5
6
 
6
7
  /**
7
8
  * Content Editor
@@ -25,7 +26,7 @@ export const ContentEditor = ({ content, filter, onChange }) => {
25
26
  {fields
26
27
  .filter(field => field.id !== 'id')
27
28
  .filter(field => filter ? filter(field, content) : true)
28
- .map((field) => <FieldEditor key={field.id} field={field} onChange={change} outlined={true}/>)}
29
+ .map((field) => <FieldEditor key={field.id} field={field} onChange={change} outlined={true} />)}
29
30
  </main>
30
31
  </section>
31
32
  )
@@ -177,8 +178,6 @@ export const FieldEditor = ({ field, onChange, content, outlined = false }) => {
177
178
  return <StringEditor outlined={outlined} field={field} value={value1} onChange={change} content={content} />
178
179
  case TYPES.BOOLEAN:
179
180
  return <CheckBox outlined id={id} label={label} value={value1} onChange={change} />
180
- case TYPES.DATE:
181
- return <TextField outlined={outlined} id={id} type='date' label={label} value={value1} onChange={change} disabled={editable} />
182
181
  case TYPES.NUMBER:
183
182
  return <NumberEditor outlined={outlined} field={field} value={value1} onChange={change} />
184
183
  case TYPES.ARRAY:
@@ -225,7 +224,7 @@ const EntityEditor = ({ field, value = {}, onChange }) => {
225
224
  * String Editor
226
225
  */
227
226
  export const StringEditor = ({ field, value = '', onChange, content, outlined }) => {
228
- const { id, label, options, editable = true, filter } = field
227
+ const { id, format, label, options, editable = true, filter } = field
229
228
 
230
229
  function change(id, value) {
231
230
  if (onChange) onChange(id, value)
@@ -239,14 +238,9 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
239
238
  return (
240
239
  <div className='field-editor string-editor'>
241
240
  {
242
- editable ?
243
- options ? (
244
- <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} />
245
- ) : (
246
- <TextField outlined={outlined} id={id} label={label} value={value} onChange={change} />
247
- ) : (
248
- <TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={true} />
249
- )
241
+ format === FORMATS.DATE ? <TextField outlined={outlined} id={id} type="date" label={label} value={value} onChange={change} readOnly={!editable} /> :
242
+ options ? <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} /> :
243
+ <TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={!editable} />
250
244
  }
251
245
  </div>
252
246
  )