♻️ better types system

This commit is contained in:
2019-01-22 12:52:22 +01:00
parent 6394f2a869
commit abd29d2999
27 changed files with 635 additions and 300 deletions

View File

@@ -4,22 +4,34 @@ import SelectValue from './Select.vue';
export default {
props: {
type: {
io: {
type: Object,
required: true,
},
direction: {
type: String,
required: true,
},
value: {
type: null,
required: true,
}
},
render(h) {
return h(
this.type === 'Image' ? ImageValue :
this.type === 'Number' ? StringValue :
this.type === 'Color' ? StringValue :
Array.isArray(this.type) ? SelectValue :
this.io.type === 'Image' ? ImageValue :
this.io.type === 'Number' ? StringValue :
this.io.type === 'Color' ? StringValue :
this.io.definition.enum ? SelectValue :
null,
{props: {value: this.value, type: this.type}})
{
props: {
io: this.io,
value: this.io.value,
type: this.io.type,
direction: this.direction
},
on: {
change: (value) => {
this.$emit('change', value);
}
}
})
}
};