pleroma-fe/src/components/settings_modal/helpers/choice_setting.js
2025-12-03 20:28:39 +02:00

54 lines
1.1 KiB
JavaScript

import Select from 'src/components/select/select.vue'
import Setting from './setting.js'
export default {
...Setting,
components: {
...Setting.components,
Select
},
props: {
...Setting.props,
overrideOptions: {
type: Boolean,
required: false
},
options: {
type: Array,
required: false
},
optionLabelMap: {
type: Object,
required: false,
default: {}
}
},
computed: {
...Setting.computed,
realOptions () {
if (this.overrideOptions) {
return this.options
}
if (this.realSource === 'admin') {
if (
!this.backendDescriptionSuggestions?.length ||
this.backendDescriptionSuggestions?.length === 0
) {
return this.options
}
return this.backendDescriptionSuggestions.map(x => ({
key: x,
value: x,
label: this.optionLabelMap[x] || x
}))
}
return this.options
}
},
methods: {
...Setting.methods,
getValue (e) {
return e
}
}
}