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%);
}
.select__option-placeholder {
color: var(--sn-grey);
}
.sn-select__no-options {
color: var(--sn-grey);
padding: .5em;

View file

@ -15,7 +15,7 @@
<div class="w-full">
<Select
:value="target"
:options="targets"
:options="getOptions(targets)"
v-bind:disabled="false"
@change="setTarget"
></Select>
@ -77,6 +77,16 @@
},
cancel() {
$(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">
<div
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="{ 'select__option-placeholder': option[1] === null }"
>
{{ option[1] }}
{{ option[1] || option[2] }}
</div>
</template>
<template v-else>
@ -54,7 +56,7 @@
computed: {
valueLabel() {
let option = this.options.find((o) => o[0] === this.value);
return option && option[1];
return option && (option[1] || option[2]);
},
focusElement() {
return this.$refs.focusElement || this.$scopedSlots.default()[0].context.$refs.focusElement;

View file

@ -3135,6 +3135,7 @@ en:
result:
title: Move to different result
targets_label: Select result
untitled_result: Untitled result
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.'