allow clearing a role's color - fixes #734

This commit is contained in:
dakkar 2025-05-01 14:23:51 +01:00
parent 121f555fca
commit bd72de2805

View file

@ -19,12 +19,15 @@ SPDX-License-Identifier: AGPL-3.0-only
@input="onInput"
>
</div>
<MkButton @click="removeColor">{{ i18n.ts.reset }}</MkButton>
<div :class="$style.caption"><slot name="caption"></slot></div>
</div>
</template>
<script lang="ts" setup>
import { ref, useTemplateRef, toRefs } from 'vue';
import MkButton from '@/components/MkButton.vue';
import { i18n } from '@/i18n.js';
const props = defineProps<{
modelValue: string | null;
@ -44,6 +47,10 @@ const inputEl = useTemplateRef('inputEl');
const onInput = () => {
emit('update:modelValue', v.value ?? '');
};
const removeColor = () => {
v.value = null;
onInput();
}
</script>
<style lang="scss" module>