mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 08:18:42 +00:00
* fix(web-frontend): remove empty option from link-to-table dropdown in form view The form-view link-row fields mount PaginatedDropdown without overriding its `addEmptyItem` prop, which defaults to true with an empty display name. That rendered a blank option at the top of the dropdown. Suppress it with `:add-empty-item="false"` on both the single and multiple link-row form components, matching the FormViewFieldSingleSelectRadios pattern (which renders no empty option). Closes #5549 * fix(backend): resolve PR feedback
54 lines
1.5 KiB
Vue
54 lines
1.5 KiB
Vue
<template>
|
|
<div class="control__elements">
|
|
<PaginatedDropdown
|
|
:fetch-page="fetchPage"
|
|
:value="dropdownValue"
|
|
:add-empty-item="!required"
|
|
:initial-display-name="initialDisplayName"
|
|
:error="touched && !valid"
|
|
:fetch-on-open="lazyLoad"
|
|
:disabled="readOnly"
|
|
:include-display-name-in-selected-event="true"
|
|
:value-name="rowDisplayName"
|
|
@input="updateValue($event)"
|
|
@hide="touch()"
|
|
></PaginatedDropdown>
|
|
<div v-show="touched && !valid" class="error">
|
|
{{ error }}
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import PaginatedDropdown from '@baserow/modules/core/components/PaginatedDropdown'
|
|
import rowEditField from '@baserow/modules/database/mixins/rowEditField'
|
|
import formViewLinkRowField from '@baserow/modules/database/mixins/formViewLinkRowField'
|
|
|
|
export default {
|
|
name: 'FormViewFieldLinkRow',
|
|
components: { PaginatedDropdown },
|
|
mixins: [rowEditField, formViewLinkRowField],
|
|
emits: ['update'],
|
|
computed: {
|
|
dropdownValue() {
|
|
return this.value.length === 0 ? false : this.value[0].id
|
|
},
|
|
initialDisplayName() {
|
|
return this.value.length === 0 ? '' : this.rowDisplayName(this.value[0])
|
|
},
|
|
},
|
|
methods: {
|
|
updateValue({ value, displayName, item }) {
|
|
if (value === null || value === '') {
|
|
this.$emit('update', [], this.value)
|
|
return
|
|
}
|
|
const selection = [
|
|
{ id: value, value: this.resolveRowValue(item, displayName) },
|
|
]
|
|
this.$emit('update', selection, this.value)
|
|
},
|
|
},
|
|
}
|
|
</script>
|