pleroma-fe/src/components/settings_modal/helpers/choice_setting.js

54 lines
1.1 KiB
JavaScript
Raw Normal View History

import Select from 'src/components/select/select.vue'
import Setting from './setting.js'
export default {
...Setting,
components: {
...Setting.components,
2026-01-06 16:22:52 +02:00
Select,
},
props: {
...Setting.props,
overrideOptions: {
type: Boolean,
2026-01-06 16:22:52 +02:00
required: false,
},
options: {
type: Array,
2026-01-06 16:22:52 +02:00
required: false,
},
optionLabelMap: {
type: Object,
required: false,
2026-01-06 16:22:52 +02:00
default: {},
},
},
computed: {
...Setting.computed,
2026-01-06 16:22:52 +02:00
realOptions() {
if (this.overrideOptions) {
return this.options
}
2023-03-21 22:46:40 +02:00
if (this.realSource === 'admin') {
2025-12-03 12:19:20 +02:00
if (
!this.backendDescriptionSuggestions?.length ||
2026-01-06 16:22:52 +02:00
this.backendDescriptionSuggestions?.length === 0
2025-12-03 12:19:20 +02:00
) {
2025-11-28 02:02:39 +02:00
return this.options
}
2026-01-06 16:22:52 +02:00
return this.backendDescriptionSuggestions.map((x) => ({
key: x,
value: x,
2026-01-06 16:22:52 +02:00
label: this.optionLabelMap[x] || x,
}))
}
return this.options
2026-01-06 16:22:52 +02:00
},
},
methods: {
...Setting.methods,
2026-01-06 16:22:52 +02:00
getValue(e) {
return e
2026-01-06 16:22:52 +02:00
},
},
}