Skip to content

Commit

Permalink
feat(pagination): add slots type (tusen-ai#6599)
Browse files Browse the repository at this point in the history
  • Loading branch information
nailiable committed Dec 7, 2024
1 parent c4bf7d1 commit 5657140
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pagination/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export type {
PaginationSizeOption
} from './src/interface'
export { default as NPagination, paginationProps } from './src/Pagination'
export type { PaginationProps } from './src/Pagination'
export type { PaginationProps, PaginationSlots } from './src/Pagination'
13 changes: 13 additions & 0 deletions src/pagination/src/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { SelectProps } from '../../select'
import type { Size as SelectSize } from '../../select/src/interface'
import type { PaginationTheme } from '../styles'
import type {
PaginationInfo,
PaginationRenderLabel,
PaginationSizeOption,
RenderGoto,
Expand All @@ -25,6 +26,7 @@ import {
nextTick,
type PropType,
ref,
type SlotsType,
toRef,
type VNodeChild,
watchEffect
Expand Down Expand Up @@ -123,9 +125,20 @@ export const paginationProps = {

export type PaginationProps = ExtractPublicPropTypes<typeof paginationProps>

export interface PaginationSlots {
default?: any
goto?: any
label?: any
next?: (info: PaginationInfo) => any
prev?: (info: PaginationInfo) => any
prefix?: (info: PaginationInfo) => any
suffix?: (info: PaginationInfo) => any
}

export default defineComponent({
name: 'Pagination',
props: paginationProps,
slots: Object as SlotsType<PaginationSlots>,
setup(props) {
if (__DEV__) {
watchEffect(() => {
Expand Down

0 comments on commit 5657140

Please sign in to comment.