From 30b758c8c0689f85f0930267d9fa487a42199130 Mon Sep 17 00:00:00 2001 From: Pierre Romera Date: Wed, 10 Jul 2024 09:13:35 +0000 Subject: [PATCH] feat: use ellipsis-tooltip --- lib/components/TinyPagination.vue | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/components/TinyPagination.vue b/lib/components/TinyPagination.vue index d2f3eaed..c8560006 100644 --- a/lib/components/TinyPagination.vue +++ b/lib/components/TinyPagination.vue @@ -45,14 +45,10 @@ :max="totalRows - 1" :aria-label="t('tiny-pagination.ariaRow')" /> -
- - - {{ t('tiny-pagination.compactRowRange', { lastRangeRow: n(lastRangeRow), totalRows: n(totalRows) }, totalRows) }} - +
- - {{ t('tiny-pagination.rowRange', { lastRangeRow: n(lastRangeRow), totalRows: n(totalRows) }, totalRows) }} + + {{ title }}
@@ -75,10 +71,10 @@ :max="numberOfPages" :aria-label="t('tiny-pagination.aria')" /> -
+
- {{ t('tiny-pagination.total', { numberOfPages: n(numberOfPages) }) }} + {{ title }}
@@ -121,13 +117,13 @@ import { PropType, ref, computed, watch } from 'vue' import { useI18n } from 'vue-i18n' -import { Size } from '@/enums' import { ButtonVariant, BFormInput, BButton } from 'bootstrap-vue-next' import { directive as vInputAutowidth } from "vue-input-autowidth" +import { Size } from '@/enums' +import vEllipsisTooltip from '@/directives/EllipsisTooltip' import PhosphorIcon from './PhosphorIcon.vue' - const props = defineProps({ /** * Total items to be stored in pages @@ -270,6 +266,16 @@ watch(() => props.modelValue, (value) => { currentRowInput.value = props.totalRows ? +props.perPage * (+value - 1) + 1 : 0 }, { immediate: true }) +const title = computed(() => { + if (props.row) { + const locales = { lastRangeRow: n(lastRangeRow.value), totalRows: n(props.totalRows) } + return t(props.compact ? 'tiny-pagination.compactRowRange' : 'tiny-pagination.rowRange', locales, props.totalRows) + } + + const locales = { numberOfPages: n(numberOfPages.value) } + return t('tiny-pagination.total', locales, props.totalRows) +}) + function applyPageForm(): void { const { value } = currentPageInput if (!isNaN(value as number)) {