1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-12 16:28:06 +00:00
bramw_baserow/web-frontend/modules/database/components/row/RowEditModalField.vue
2020-05-11 17:27:35 +00:00

58 lines
1.2 KiB
Vue

<template>
<div class="control">
<label class="control-label">
<i
class="fas control-label-icon"
:class="'fa-' + field._.type.iconClass"
></i>
{{ field.name }}
<a
ref="contextLink"
class="control-context"
@click="$refs.context.toggle($refs.contextLink, 'bottom', 'left', 0)"
>
<i class="fas fa-caret-down"></i>
</a>
</label>
<FieldContext ref="context" :field="field"></FieldContext>
<component
:is="getFieldComponent(field.type)"
ref="field"
:field="field"
:value="row['field_' + field.id]"
@update="update"
/>
</div>
</template>
<script>
import FieldContext from '@baserow/modules/database/components/field/FieldContext'
export default {
name: 'RowEditModalField',
components: { FieldContext },
props: {
field: {
type: Object,
required: true,
},
row: {
type: Object,
required: true,
},
},
methods: {
getFieldComponent(type) {
return this.$registry.get('field', type).getRowEditFieldComponent()
},
update(value, oldValue) {
this.$emit('update', {
row: this.row,
field: this.field,
value,
oldValue,
})
},
},
}
</script>