Fixed empty calculated inline fields showing calc

This commit is contained in:
Stefan Zermatten
2022-09-25 12:39:49 +02:00
parent 9f0ffe13f8
commit 87f79737e8
2 changed files with 39 additions and 19 deletions

View File

@@ -10,7 +10,7 @@
</v-toolbar-title> </v-toolbar-title>
<v-spacer /> <v-spacer />
</template> </template>
<v-card-text v-if="model.summary"> <v-card-text v-if="summaryText">
<property-description <property-description
text text
:model="model.summary" :model="model.summary"
@@ -20,21 +20,31 @@
</template> </template>
<script lang="js"> <script lang="js">
import ToolbarCard from '/imports/ui/components/ToolbarCard.vue'; import ToolbarCard from '/imports/ui/components/ToolbarCard.vue';
import PropertyDescription from '/imports/ui/properties/viewers/shared/PropertyDescription.vue' import PropertyDescription from '/imports/ui/properties/viewers/shared/PropertyDescription.vue'
export default { export default {
components: { components: {
ToolbarCard, ToolbarCard,
PropertyDescription, PropertyDescription,
}, },
props: { props: {
model: { model: {
type: Object, type: Object,
required: true, required: true,
}, },
}, },
}; computed: {
summaryText() {
if (!this.model || !this.model.summary) return;
if (typeof this.model.summary.value === 'string') {
return this.model.summary.value;
} else {
return this.model.summary.text
}
},
}
};
</script> </script>
<style lang="css" scoped> <style lang="css" scoped>

View File

@@ -1,15 +1,15 @@
<template lang="html"> <template lang="html">
<markdown-text <markdown-text
v-if="text && model" v-if="text && model"
:markdown="model.value || model.text" :markdown="textValue"
/> />
<property-field <property-field
v-else-if="model && (model.value || model.text)" v-else-if="model && textValue"
:name="name" :name="name"
:cols="{cols: 12}" :cols="{cols: 12}"
> >
<markdown-text <markdown-text
:markdown="model.value || model.text" :markdown="textValue"
/> />
</property-field> </property-field>
</template> </template>
@@ -33,7 +33,17 @@ export default {
default: undefined, default: undefined,
}, },
text: Boolean, text: Boolean,
}, },
computed: {
textValue() {
if (!this.model) return;
if (typeof this.model.value === 'string') {
return this.model.value;
} else {
return this.model.text
}
},
},
} }
</script> </script>