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

View file

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