Merge pull request 'feat: #8238 added function to copy id in CardDescriptor' (!1387) from 8238-idCopyButton into dev
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1387
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
PAU ROVIRA ROSALENY 2025-02-13 12:12:26 +00:00
commit d38a07f881
1 changed files with 32 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import { useArrayData } from 'composables/useArrayData';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useState } from 'src/composables/useState';
import { useRoute } from 'vue-router';
import { useClipboard } from 'src/composables/useClipboard';
import VnMoreOptions from './VnMoreOptions.vue';
const $props = defineProps({
@ -42,6 +43,7 @@ const $props = defineProps({
const state = useState();
const route = useRoute();
const { t } = useI18n();
const { copyText } = useClipboard();
const { viewSummary } = useSummaryDialog();
let arrayData;
let store;
@ -99,6 +101,14 @@ function getValueFromPath(path) {
return current;
}
function copyIdText(id) {
copyText(id, {
component: {
copyValue: id,
},
});
}
const emit = defineEmits(['onFetch']);
const iconModule = computed(() => route.matched[1].meta.icon);
@ -182,9 +192,22 @@ const toModule = computed(() =>
</slot>
</div>
</QItemLabel>
<QItem dense>
<QItem>
<QItemLabel class="subtitle" caption>
#{{ getValueFromPath(subtitle) ?? entity.id }}
<QBtn
round
flat
dense
size="sm"
icon="content_copy"
color="primary"
@click.stop="copyIdText(entity.id)"
>
<QTooltip>
{{ t('globals.copyId') }}
</QTooltip>
</QBtn>
</QItemLabel>
</QItem>
</QList>
@ -292,3 +315,11 @@ const toModule = computed(() =>
}
}
</style>
<i18n>
en:
globals:
copyId: Copy ID
es:
globals:
copyId: Copiar ID
</i18n>