Placeholder text in the "Move to different result" modal dropdown

This commit is contained in:
Giga Chubinidze 2023-09-01 11:49:43 +04:00
parent 19026b936d
commit 100fdde5ca
4 changed files with 21 additions and 4 deletions

View file

@ -90,6 +90,10 @@
width: calc(100%); width: calc(100%);
} }
.select__option-placeholder {
color: var(--sn-grey);
}
.sn-select__no-options { .sn-select__no-options {
color: var(--sn-grey); color: var(--sn-grey);
padding: .5em; padding: .5em;

View file

@ -15,7 +15,7 @@
<div class="w-full"> <div class="w-full">
<Select <Select
:value="target" :value="target"
:options="targets" :options="getOptions(targets)"
v-bind:disabled="false" v-bind:disabled="false"
@change="setTarget" @change="setTarget"
></Select> ></Select>
@ -77,6 +77,16 @@
}, },
cancel() { cancel() {
$(this.$refs.modal).modal('hide'); $(this.$refs.modal).modal('hide');
},
getOptions(targets) {
const updatedTargets = targets.map(target => {
if (target[1] === null) {
target[2] = this.i18n.t('protocols.steps.modals.move_element.result.untitled_result');
}
return target;
});
return updatedTargets;
} }
} }
} }

View file

@ -14,10 +14,12 @@
<template v-if="options.length"> <template v-if="options.length">
<div <div
v-for="option in options" v-for="option in options"
:key="option[0]" @mousedown.prevent.stop="setValue(option[0])" :key="option[0]"
@mousedown.prevent.stop="setValue(option[0])"
class="sn-select__option" class="sn-select__option"
:class="{ 'select__option-placeholder': option[1] === null }"
> >
{{ option[1] }} {{ option[1] || option[2] }}
</div> </div>
</template> </template>
<template v-else> <template v-else>
@ -54,7 +56,7 @@
computed: { computed: {
valueLabel() { valueLabel() {
let option = this.options.find((o) => o[0] === this.value); let option = this.options.find((o) => o[0] === this.value);
return option && option[1]; return option && (option[1] || option[2]);
}, },
focusElement() { focusElement() {
return this.$refs.focusElement || this.$scopedSlots.default()[0].context.$refs.focusElement; return this.$refs.focusElement || this.$scopedSlots.default()[0].context.$refs.focusElement;

View file

@ -3135,6 +3135,7 @@ en:
result: result:
title: Move to different result title: Move to different result
targets_label: Select result targets_label: Select result
untitled_result: Untitled result
delete_step: delete_step:
title: 'Delete step' title: 'Delete step'
description_1: 'Youre about to delete a whole step from your protocol. It might contain data you dont want to lose. You wont be able to get it back.' description_1: 'Youre about to delete a whole step from your protocol. It might contain data you dont want to lose. You wont be able to get it back.'