ywana-core8 0.0.70 → 0.0.74
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/dist/index.cjs +24 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +4 -1
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +24 -24
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +24 -23
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -1
- package/src/css/html.css +4 -0
- package/src/domain/ContentEditor.js +8 -14
- package/src/domain/ContentType.js +9 -2
- package/src/domain/index.js +1 -1
- package/src/html/tree.css +0 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "ywana-core8",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.74",
|
4
4
|
"description": "ywana-core8",
|
5
5
|
"author": "Ernesto Roldan Garcia",
|
6
6
|
"license": "MIT",
|
@@ -28,6 +28,7 @@
|
|
28
28
|
"dependencies": {
|
29
29
|
"deep-equal": "^2.0.5",
|
30
30
|
"material-design-icons-iconfont": "^6.1.1",
|
31
|
+
"react-datepicker": "^4.6.0",
|
31
32
|
"resumablejs": "^1.1.0"
|
32
33
|
}
|
33
34
|
}
|
package/src/css/html.css
CHANGED
@@ -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} />)}
|
29
|
+
.map((field) => <FieldEditor key={field.id} field={field} onChange={change} outlined={true} />)}
|
29
30
|
</main>
|
30
31
|
</section>
|
31
32
|
)
|
@@ -143,7 +144,7 @@ export const TreededContentEditor = ({ content, filter, onChange }) => {
|
|
143
144
|
</header>
|
144
145
|
<Tree>
|
145
146
|
{nodes.map((node, index) => (
|
146
|
-
<TreeNode icon="folder" label={node.label} actions={[<Icon small icon="add" clickable action={add} />]}>
|
147
|
+
<TreeNode icon="folder" label={node.label} actions={[<Icon size="small" icon="add" clickable action={add} />]}>
|
147
148
|
{
|
148
149
|
value[node.id] ? value[node.id].map((field, index) => <TreeItem icon={field.icon || "description"} label={field.name || field.label} onSelect={() => select(index, field, node)} />) : null
|
149
150
|
}
|
@@ -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
|
-
<
|
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
|
)
|
@@ -362,7 +356,7 @@ export const CollectionEditor = ({ field, value = [], onChange }) => {
|
|
362
356
|
...item,
|
363
357
|
id: index,
|
364
358
|
actions: [
|
365
|
-
<Icon icon='delete' clickable action={() => remove(index)} small />
|
359
|
+
<Icon icon='delete' clickable action={() => remove(index)} size="small" />
|
366
360
|
]
|
367
361
|
}))
|
368
362
|
|
@@ -4,12 +4,19 @@
|
|
4
4
|
export const TYPES = {
|
5
5
|
STRING: 'String',
|
6
6
|
NUMBER: 'Number',
|
7
|
-
DATE: 'Date',
|
8
7
|
BOOLEAN: 'Boolean',
|
9
8
|
ARRAY: 'Array',
|
10
9
|
ENTITY: 'Object',
|
11
10
|
FUNCTION: 'Function',
|
12
|
-
|
11
|
+
}
|
12
|
+
|
13
|
+
/**
|
14
|
+
* FORMATS
|
15
|
+
*/
|
16
|
+
export const FORMATS = {
|
17
|
+
NONE: '',
|
18
|
+
DATE: 'date',
|
19
|
+
EMAIL: 'email',
|
13
20
|
}
|
14
21
|
|
15
22
|
/**
|
package/src/domain/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { TYPES, Content } from './ContentType'
|
1
|
+
export { TYPES, FORMATS, Content } from './ContentType'
|
2
2
|
export { ContentForm } from './ContentForm'
|
3
3
|
export { ContentEditor, TabbedContentEditor, CollectionEditor, TreededContentEditor, FieldEditor, ListEditor } from './ContentEditor'
|
4
4
|
export { CreateContentDialog } from './CreateContentDialog'
|