Skip to content

Commit

Permalink
Show error on list input field (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamPrestor authored Sep 12, 2023
1 parent b2922d3 commit 6dd6008
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<div style="flex: auto">
<component :is="renderComponent" v-bind="renderComponentData"/>
</div>
</template>
Expand Down
16 changes: 14 additions & 2 deletions vue/dynamicforms/src/components/form/inputs/list.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<template>
<APIConsumerVue v-if="consumer" :consumer="consumer" :display-component="displayComponent"/>
<v-input v-bind="binds">
<APIConsumerVue v-if="consumer" :consumer="consumer" :display-component="displayComponent"/>
</v-input>
</template>

<script lang="ts">
import _ from 'lodash';
import { defineComponent, ref } from 'vue';
import APIConsumerVue from '../../api_consumer/api-consumer.vue';
Expand All @@ -27,6 +30,15 @@ export default defineComponent({
}
return { displayComponent, setConsumer, consumer };
},
computed: {
binds() {
const binds = _.cloneDeep(this.baseBinds);
binds['error-messages'] = binds['error-messages']
.filter((el: any) => !(el === undefined || el === null || !Object.keys(el).length))
.map((el: { [key: string]: string }) => Object.keys(el).map((key) => `${key}: ${el[key]}`));
return binds;
},
},
watch: {
modelValue(newValue) {
this.consumer = new ConsumerLogicArray(this.field.renderParams.formComponentDef!, newValue);
Expand All @@ -41,7 +53,7 @@ export default defineComponent({
},
async mounted() {
// `${this.field.renderParams.formComponentDef?.detail_url.split('/').slice(0, -1).join('/')}.componentdef`,
this.setConsumer(
await this.setConsumer(
this.field.renderParams.formComponentDef!,
this.modelValue as any[],
);
Expand Down

0 comments on commit 6dd6008

Please sign in to comment.