ywana-core8 0.0.601 → 0.0.604
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 +51 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +51 -3
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +51 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/ContentViewer.js +18 -4
- package/src/widgets/empty/EmptyMessage.css +3 -0
- package/src/widgets/empty/EmptyMessage.js +17 -0
- package/src/widgets/index.js +2 -1
package/package.json
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react'
|
2
|
-
import { Property } from '../html'
|
2
|
+
import { Icon, Property } from '../html'
|
3
|
+
import { EmptyMessage } from '../widgets'
|
3
4
|
import { Content, FORMATS, TYPES } from './ContentType'
|
4
5
|
import './ContentViewer.css'
|
5
6
|
|
@@ -27,7 +28,7 @@ export const ContentViewer = (props) => {
|
|
27
28
|
{title}
|
28
29
|
</header>
|
29
30
|
<main>
|
30
|
-
{fields.map(field => <FieldViewer key={field.id} field={field} value={value[field.id]} />)}
|
31
|
+
{ fields.length > 0 ? fields.map(field => <FieldViewer key={field.id} field={field} value={value[field.id]} />) : <EmptyMessage icon="search" text="..."/> }
|
31
32
|
</main>
|
32
33
|
</section>
|
33
34
|
)
|
@@ -52,6 +53,8 @@ const FieldViewer = (props) => {
|
|
52
53
|
if (hidden) return null;
|
53
54
|
|
54
55
|
switch (type) {
|
56
|
+
case TYPES.BOOLEAN:
|
57
|
+
return <BooleanViewer field={field} value={value} />
|
55
58
|
case TYPES.STRING:
|
56
59
|
return <StringViewer field={field} value={value} />
|
57
60
|
case TYPES.ENTITY:
|
@@ -84,6 +87,17 @@ const EntityViewer = (props) => {
|
|
84
87
|
)
|
85
88
|
}
|
86
89
|
|
90
|
+
/**
|
91
|
+
* Boolean Viewer
|
92
|
+
*/
|
93
|
+
const BooleanViewer = (props) => {
|
94
|
+
const { field, value } = props
|
95
|
+
const { label, options } = field
|
96
|
+
const iconName = value === true ? "check_box" : "check_box_outline_blank"
|
97
|
+
const icon = <Icon icon={iconName} />
|
98
|
+
return <Property label={label} value={icon} options={options} />
|
99
|
+
}
|
100
|
+
|
87
101
|
/**
|
88
102
|
* StringViewer
|
89
103
|
*/
|
@@ -119,11 +133,11 @@ const ArrayViewer = (props) => {
|
|
119
133
|
{columns.map(column => <th key={column}>{column}</th>)}
|
120
134
|
</thead>
|
121
135
|
<tbody>
|
122
|
-
{value.map(v => (
|
136
|
+
{value.length >0 ? value.map(v => (
|
123
137
|
<tr>
|
124
138
|
{Object.keys(item).map(key => <td key={v[key]}>{v[key]}</td>)}
|
125
139
|
</tr>
|
126
|
-
))}
|
140
|
+
)) : <EmptyMessage icon="search" text="..."/>}
|
127
141
|
</tbody>
|
128
142
|
</table>
|
129
143
|
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Icon, Text } from '../../html'
|
3
|
+
import './EmptyMessage.css'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Empty Message
|
7
|
+
*/
|
8
|
+
export const EmptyMessage = ({ icon, text }) => {
|
9
|
+
|
10
|
+
return (
|
11
|
+
<div className="empty">
|
12
|
+
<span><Icon icon={icon} /></span>
|
13
|
+
<br />
|
14
|
+
<Text use="subtitle2">{text}</Text>
|
15
|
+
</div>
|
16
|
+
)
|
17
|
+
}
|
package/src/widgets/index.js
CHANGED