ywana-core8 0.0.189 → 0.0.193
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 +54 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +54 -3
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +54 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -1
- package/src/domain/ContentViewer.css +0 -0
- package/src/domain/ContentViewer.js +51 -0
- package/src/domain/TablePage.js +4 -3
- package/src/html/textfield.js +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "ywana-core8",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.193",
|
4
4
|
"description": "ywana-core8",
|
5
5
|
"author": "Ernesto Roldan Garcia",
|
6
6
|
"license": "MIT",
|
@@ -15,6 +15,9 @@
|
|
15
15
|
"bugs": {
|
16
16
|
"url": "https://github.com/ywana/ywana-core8/issues"
|
17
17
|
},
|
18
|
+
"resolutions": {
|
19
|
+
"react-error-overlay": "6.0.9"
|
20
|
+
},
|
18
21
|
"peerDependencies": {
|
19
22
|
"react": "17.x",
|
20
23
|
"react-dom": "17.x"
|
File without changes
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Property } from '../html'
|
3
|
+
import { TYPES } from './ContentType'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Content Viewer
|
7
|
+
*
|
8
|
+
* @param {*} props
|
9
|
+
* @returns
|
10
|
+
*/
|
11
|
+
export const ContentViewer = (props) => {
|
12
|
+
|
13
|
+
const { content, field } = props
|
14
|
+
|
15
|
+
if (!content) return <div>No Content...</div>
|
16
|
+
|
17
|
+
const sections = content.sections()
|
18
|
+
|
19
|
+
return (
|
20
|
+
<div className="content-viewer">
|
21
|
+
{sections.map(section => {
|
22
|
+
const { title, fields } = section
|
23
|
+
return (
|
24
|
+
<section key={title}>
|
25
|
+
<header>
|
26
|
+
{title}
|
27
|
+
</header>
|
28
|
+
<main>
|
29
|
+
{ fields.map( field => <FieldViewer key={field.id} field={field} value={content[field.id]} />)}
|
30
|
+
</main>
|
31
|
+
</section>
|
32
|
+
)
|
33
|
+
})}
|
34
|
+
</div>
|
35
|
+
)
|
36
|
+
}
|
37
|
+
|
38
|
+
const FieldViewer = (props) => {
|
39
|
+
|
40
|
+
const { field, value } = props
|
41
|
+
const { id, type, item, label } = field
|
42
|
+
|
43
|
+
console.log('FieldViewer', field, value)
|
44
|
+
|
45
|
+
switch(type) {
|
46
|
+
case TYPES.STRING:
|
47
|
+
return <Property label={label} value={value} />
|
48
|
+
default:
|
49
|
+
return <div>{label}</div>
|
50
|
+
}
|
51
|
+
}
|
package/src/domain/TablePage.js
CHANGED
@@ -5,6 +5,7 @@ import { HTTPClient, Session } from '../http'
|
|
5
5
|
import { PageContext, SiteContext } from '../site'
|
6
6
|
import { ContentEditor } from './ContentEditor'
|
7
7
|
import { Content } from './ContentType'
|
8
|
+
import { ContentViewer } from './ContentViewer'
|
8
9
|
import { CreateContentDialog } from './CreateContentDialog'
|
9
10
|
import "./TablePage.css"
|
10
11
|
|
@@ -95,7 +96,7 @@ export const TablePage = (props) => {
|
|
95
96
|
if (rowSelected || rowChecked) {
|
96
97
|
return (
|
97
98
|
<aside className="table-page">
|
98
|
-
{rowSelected ? <TableRowEditor content={new Content(schema, form)} filter={editorFilter} onChange={change} onClose={closeAside} /> : null}
|
99
|
+
{rowSelected ? <TableRowEditor content={new Content(schema, form)} filter={editorFilter} onChange={change} onClose={closeAside} editable={editable}/> : null}
|
99
100
|
{rowChecked ? <TableSelector schema={schema} actions={selectionActions} /> : null}
|
100
101
|
</aside>
|
101
102
|
)
|
@@ -138,14 +139,14 @@ export const TablePage = (props) => {
|
|
138
139
|
* TableRowEditor
|
139
140
|
*/
|
140
141
|
const TableRowEditor = (props) => {
|
141
|
-
const { name, content, filter, onChange, onClose } = props
|
142
|
+
const { name, content, filter, editable, onChange, onClose } = props
|
142
143
|
return (
|
143
144
|
<div className="table-row-editor">
|
144
145
|
<Header icon="local_offer" title={name || "Propiedades"}>
|
145
146
|
<Icon icon="close" clickable action={onClose} />
|
146
147
|
</Header>
|
147
148
|
<main>
|
148
|
-
<ContentEditor content={content} onChange={onChange} filter={filter} />
|
149
|
+
{ editable ? <ContentEditor content={content} onChange={onChange} filter={filter} /> : <ContentViewer content={content} /> }
|
149
150
|
</main>
|
150
151
|
</div>
|
151
152
|
)
|
package/src/html/textfield.js
CHANGED
@@ -49,7 +49,7 @@ export const TextField = (props) => {
|
|
49
49
|
return (
|
50
50
|
<div className={`${style}`} onClick={onClick}>
|
51
51
|
<input id={id} type={type} placeholder={placeholder} value={value} required onChange={change} onKeyDown={onKeyPress} onFocus={focus} readOnly={readOnly} />
|
52
|
-
{canClear && value && value.length > 0 ? <Icon icon="close" clickable size="small" action={clear} /> : null }
|
52
|
+
{!readOnly && canClear && value && value.length > 0 ? <Icon icon="close" clickable size="small" action={clear} /> : null }
|
53
53
|
<span className="bar"></span>
|
54
54
|
{label ? <label>{labelTxt}</label> : null}
|
55
55
|
</div>
|