LCOV - code coverage report
Current view: top level - packages/design-system/src/components/pagination - Pagination.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 63.6 % 11 7
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1           16 : <template>
       2           40 :   <PaginationRoot
       3              :     v-model:page="page"
       4              :     :total
       5              :     :items-per-page
       6              :     :sibling-count="1"
       7              :     show-edges
       8              :   >
       9              :     <div class="flex flex-wrap items-center justify-center gap-2">
      10              :       <div
      11              :         v-if="itemsPerPageOptions?.length"
      12              :         class="mr-2 flex items-center gap-2"
      13              :       >
      14              :         <span class="text-sm text-muted-foreground">
      15              :           {{ itemsPerPageLabel }}
      16              :         </span>
      17              :         <Select
      18              :           :model-value="itemsPerPage"
      19              :           @update:model-value="updateItemsPerPage"
      20              :         >
      21              :           <SelectTrigger size="md" class="w-20" :aria-label="itemsPerPageLabel">
      22              :             <SelectValue />
      23              :           </SelectTrigger>
      24              :           <SelectContent>
      25          120 :             <SelectItem
      26              :               v-for="option in itemsPerPageOptions"
      27              :               :key="option"
      28              :               :value="option"
      29              :             >
      30              :               {{ option }}
      31              :             </SelectItem>
      32              :           </SelectContent>
      33              :         </Select>
      34              :       </div>
      35              :       <PaginationPrev as-child>
      36              :         <Button
      37              :           variant="muted-textonly"
      38              :           size="md"
      39              :           class="text-sm"
      40              :           :aria-label="previousLabel"
      41              :         >
      42              :           <i class="icon-[lucide--chevron-left]" />
      43              :           {{ previousLabel }}
      44              :         </Button>
      45              :       </PaginationPrev>
      46              :       <PaginationList v-slot="{ items }" class="flex items-center gap-1">
      47          120 :         <template v-for="(item, index) in items" :key="index">
      48              :           <PaginationListItem
      49              :             v-if="item.type === 'page'"
      50              :             :value="item.value"
      51              :             as-child
      52              :           >
      53              :             <Button
      54              :               :variant="item.value === page ? 'secondary' : 'muted-textonly'"
      55              :               size="icon"
      56              :               :aria-label="formatPageLabel(item.value)"
      57              :             >
      58              :               {{ item.value }}
      59              :             </Button>
      60              :           </PaginationListItem>
      61              :           <PaginationEllipsis v-else :index="index" :class="ellipsisClass">
      62              :             …
      63              :           </PaginationEllipsis>
      64              :         </template>
      65              :       </PaginationList>
      66              :       <PaginationNext as-child>
      67              :         <Button
      68              :           variant="muted-textonly"
      69              :           size="md"
      70              :           class="text-sm"
      71              :           :aria-label="nextLabel"
      72              :         >
      73              :           {{ nextLabel }}
      74              :           <i class="icon-[lucide--chevron-right]" />
      75              :         </Button>
      76              :       </PaginationNext>
      77              :     </div>
      78              :   </PaginationRoot>
      79              : </template>
      80              : 
      81              : <script setup lang="ts">
      82              : import type { AcceptableValue } from 'reka-ui'
      83              : import {
      84              :   PaginationEllipsis,
      85              :   PaginationList,
      86              :   PaginationListItem,
      87              :   PaginationNext,
      88              :   PaginationPrev,
      89              :   PaginationRoot
      90              : } from 'reka-ui'
      91              : 
      92              : import Button from '@comfyorg/design-system/button/Button'
      93              : import Select from '@comfyorg/design-system/select/Select'
      94              : import SelectContent from '@comfyorg/design-system/select/SelectContent'
      95              : import SelectItem from '@comfyorg/design-system/select/SelectItem'
      96              : import SelectTrigger from '@comfyorg/design-system/select/SelectTrigger'
      97              : import SelectValue from '@comfyorg/design-system/select/SelectValue'
      98              : 
      99              : const { total, itemsPerPageOptions } = defineProps<{
     100              :   total: number
     101              :   itemsPerPageLabel: string
     102              :   previousLabel: string
     103              :   nextLabel: string
     104              :   formatPageLabel: (page: number) => string
     105              :   itemsPerPageOptions?: number[]
     106              : }>()
     107              : 
     108           40 : const page = defineModel<number>('page', { default: 1 })
     109           40 : const itemsPerPage = defineModel<number>('itemsPerPage', { default: 10 })
     110              : 
     111            0 : function updateItemsPerPage(value: AcceptableValue) {
     112            0 :   if (typeof value !== 'number') return
     113            0 :   itemsPerPage.value = value
     114            0 :   page.value = 1
     115              : }
     116              : 
     117           38 : const ellipsisClass =
     118              :   'inline-flex size-8 items-center justify-center text-sm text-muted-foreground'
     119              : </script>
        

Generated by: LCOV version 2.0-1