Skip to content

⬅️ Back to Table of Contents

πŸ“„ useOffsetPagination

πŸ“Š Analysis Summary

Metric Count
πŸ”§ Functions 3
πŸ“¦ Imports 14
🟒 Vue Composition API 9
πŸ“ Interfaces 2
πŸ“‘ Type Aliases 1

πŸ“š Table of Contents

πŸ› οΈ File Location:

πŸ“‚ packages/core/useOffsetPagination/index.ts

πŸ“¦ Imports

Name Source
ComputedRef vue
MaybeRef vue
MaybeRefOrGetter vue
Ref vue
UnwrapNestedRefs vue
noop @vueuse/shared
syncRef @vueuse/shared
computed vue
isReadonly vue
isRef vue
reactive vue
toValue vue
watch vue
useClamp ../../math/useClamp

Vue Composition API

Name Type Reactive Variables Composables
computed computed none none
computed computed none none
computed computed none none
watch watch none none
reactive reactive none none
watch watch none none
reactive reactive none none
watch watch none none
reactive reactive none none

Functions

useOffsetPagination(options: Omit<UseOffsetPaginationOptions, 'total…): UseOffsetPaginationInfinityPageReturn

Parameters:

  • options Omit<UseOffsetPaginationOptions, 'total'>

Returns: UseOffsetPaginationInfinityPageReturn

Code
export function useOffsetPagination(options: Omit<UseOffsetPaginationOptions, 'total'>): UseOffsetPaginationInfinityPageReturn

Internal helpers

Declared inside another function in this file.

prev(): void

Returns: void

Code
function prev() {
    currentPage.value--
  }

next(): void

Returns: void

Code
function next() {
    currentPage.value++
  }

Interfaces

UseOffsetPaginationOptions

Interface Code
export interface UseOffsetPaginationOptions {
  /**
   * Total number of items.
   */
  total?: MaybeRefOrGetter<number>

  /**
   * The number of items to display per page.
   * @default 10
   */
  pageSize?: MaybeRefOrGetter<number>

  /**
   * The current page number.
   * @default 1
   */
  page?: MaybeRef<number>

  /**
   * Callback when the `page` change.
   */
  onPageChange?: (returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown

  /**
   * Callback when the `pageSize` change.
   */
  onPageSizeChange?: (returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown

  /**
   * Callback when the `pageCount` change.
   */
  onPageCountChange?: (returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown
}

Properties

Name Type Optional Description
total MaybeRefOrGetter<number> βœ“ not shown
pageSize MaybeRefOrGetter<number> βœ“ not shown
page MaybeRef<number> βœ“ not shown
onPageChange (returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown βœ“ not shown
onPageSizeChange (returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown βœ“ not shown
onPageCountChange (returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown βœ“ not shown

UseOffsetPaginationReturn

Interface Code
export interface UseOffsetPaginationReturn {
  currentPage: Ref<number>
  currentPageSize: Ref<number>
  pageCount: ComputedRef<number>
  isFirstPage: ComputedRef<boolean>
  isLastPage: ComputedRef<boolean>
  prev: () => void
  next: () => void
}

Properties

Name Type Optional Description
currentPage Ref<number> βœ— not shown
currentPageSize Ref<number> βœ— not shown
pageCount ComputedRef<number> βœ— not shown
isFirstPage ComputedRef<boolean> βœ— not shown
isLastPage ComputedRef<boolean> βœ— not shown
prev () => void βœ— not shown
next () => void βœ— not shown

Type Aliases

UseOffsetPaginationInfinityPageReturn

type UseOffsetPaginationInfinityPageReturn = Omit<UseOffsetPaginationReturn, 'isLastPage'>;

Generated by Syntax Scribe