ywana-core8 0.0.446 → 0.0.449
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 +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +5 -5
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/ContentType.js +5 -1
- package/src/domain/ContentViewer.js +2 -3
package/package.json
CHANGED
@@ -121,7 +121,7 @@ export class ContentType {
|
|
121
121
|
const fields = Object.entries(this._schema)
|
122
122
|
const next = fields.reduce((next, [name, field]) => {
|
123
123
|
|
124
|
-
const { type, item } = field
|
124
|
+
const { type, item, optional } = field
|
125
125
|
const entryData = data ? data[name] : null
|
126
126
|
|
127
127
|
switch (type) {
|
@@ -139,6 +139,10 @@ export class ContentType {
|
|
139
139
|
break
|
140
140
|
|
141
141
|
case TYPES.ENTITY:
|
142
|
+
|
143
|
+
if (optional === true) console.log('OPTIONAL', field, entryData);
|
144
|
+
if (optional === true && entryData === null) break;
|
145
|
+
|
142
146
|
const child1 = new ContentType(item)
|
143
147
|
next[name] = child1.value(entryData)
|
144
148
|
break;
|
@@ -45,11 +45,10 @@ export const ContentViewer = (props) => {
|
|
45
45
|
const FieldViewer = (props) => {
|
46
46
|
|
47
47
|
const { field, value } = props
|
48
|
-
const { id, type, item, label, visible = true
|
48
|
+
const { id, type, item, label, visible = true } = field
|
49
49
|
|
50
50
|
if (!visible) return null
|
51
|
-
|
52
|
-
console.log('contentviewer>fieldViewer', field, optional, !value)
|
51
|
+
|
53
52
|
switch (type) {
|
54
53
|
case TYPES.STRING:
|
55
54
|
return <Property label={label} value={value} />
|