set 'required' only for 'InputItem', set base value as null, removed test

This commit is contained in:
Axolotle 2020-10-08 14:07:44 +02:00
parent a12dc45229
commit 67dc725385
2 changed files with 6 additions and 16 deletions

View file

@ -4,10 +4,7 @@
:label="label" :label-for="'form-item-' + props.id"
>
<slot name="default">
<component
:is="component" v-bind="props"
v-model="props.value" @input="test"
/>
<component :is="component" v-bind="props" v-model="props.value" />
</slot>
<template v-if="description || example || link" v-slot:description>
@ -19,9 +16,7 @@
</b-link>
</div>
<template v-if="description">
{{ description }}
</template>
<span v-if="description" v-html="description" />
</template>
<b-form-invalid-feedback v-if="'isValid' in props" :id="props.id + '-feedback'" :state="props.value.isValid">
@ -47,13 +42,6 @@ export default {
return {
content: this.value
}
},
methods: {
test () {
console.log(this.props.value)
// this.props.isValid = false
}
}
}
</script>

View file

@ -11,7 +11,7 @@ export function formatYunoHostArgument (_arg) {
const arg = {
component: undefined,
label: formatI18nField(_arg.ask),
props: { id: _arg.name }
props: { id: _arg.name, value: null }
}
// Some apps has `string` as type but expect a select since it has `choices`
@ -43,7 +43,9 @@ export function formatYunoHostArgument (_arg) {
}
// Required
arg.props.required = _arg.optional !== true
if (arg.component === 'InputItem') {
arg.props.required = _arg.optional !== true
}
// Default value
if (_arg.default) {
arg.props.value = _arg.default