Skip to content

Commit

Permalink
fix: [pagination] 修复ts类型报错 fix #948
Browse files Browse the repository at this point in the history
  • Loading branch information
haohao_peng committed Nov 20, 2024
1 parent 1e51e8d commit a932185
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion components/dropdown/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface DropDownProps extends PopperProps {
style?: Record<string, unknown>
children?: React.ReactNode
onItemClick?: (key: string) => void
menu: React.ReactElement | Array<MenuItem>
menu?: React.ReactElement | Array<MenuItem>
menuAnimation?: boolean
}

Expand Down
1 change: 1 addition & 0 deletions components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export { default as Message } from './message'
export { default as Notification } from './notification'

export { default as Pagination } from './pagination'
export type { IPaginationProps } from './pagination'

export { default as Progress } from './progress'

Expand Down
40 changes: 20 additions & 20 deletions components/pagination/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ subtitle: 分页

## API

| 参数 | 说明 | 类型 | 默认值 | 版本 |
|------------------|-----------------------------------------------------------------------------|--------------------------------------------| --- | --- |
| bordered | 是否加边框 | boolean | false | |
| current | 当前页码 | number | - | 1.0.0 |
| defaultCurrent | 默认当前页码 | number | 1 | 1.0.0 |
| defaultPageSize | 默认每页条码 | number | 10 | 1.0.0 |
| disabled | 禁用分页 | boolean | - | 1.0.0 |
| dropdownProps | `pageSize` 切换器属性 | [DropdownProps](/components/dropdown/#API) | - | 1.0.0 |
| hideOnSinglePage | 只有一页时是否隐藏分页组件 | boolean | false | 1.0.0 |
| pageSize | 每页条目数 | number | - | 1.0.0 |
| pageSizeOptions | `pageSize` 切换器的下拉列表 | string\[] | \[`10`, `20`, `50`, `100`] | 1.0.0 |
| pageType | 分页类型,基础(basic)、单据(bill)、简化(simple)、较少(less)和精细(nicety)可选,默认是基础(basic) | `basic` \ | `bill` \| `simple` \| `less` \| `nicety` | `basic` | 1.0.0 |
| showTotal | 是否显示总计,默认为false, 当pageType为`basic`时,默认为`page`, 当pageType为`nicety`时,默认为`row` | boolean \ | `page` \| `row` \| `all` | false | 1.0.0 |
| showQuickJumper | 是否可以快速跳转至某页,默认为true, 当pageType为`bill`时,默认为false | boolean | true | 1.0.0 |
| showSizeChanger | 是否展示 `pageSize` 切换器,当 `total` 大于 50 时默认为 true | boolean | - | 1.0.0 |
| showTitle | 是否显示原生 tooltip 页码 | boolean | true | 1.0.0 |
| total | 数据总量 | number | 0 | 1.0.0 |
| onChange | 页码改变的回调,参数是改变后的页码及每页条目数 | function(page, pageSize) | - | 1.0.0 |
| onShowSizeChange | pageSize 变化后的回调 | function(current, size) | - | 1.0.0 |
| icons | 替换图标 | IIcon | {} | 1.0.0 |
| 参数 | 说明 | 类型 | 默认值 | 可选值 | 版本 |
| ---------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------ | ---------------------------------------- | ------- |
| bordered | 是否加边框 | boolean | false | `true` `false` | 1.0.0 |
| current | 当前页码 | number | - | - | 1.0.0 |
| defaultCurrent | 默认当前页码 | number | - | - | 1.0.0 |
| defaultPageSize | 默认每页条码 | number | 10 | - | 1.0.0 |
| disabled | 禁用分页 | boolean | - | `true` `false`| 1.0.0 |
| dropdownProps | `pageSize` 切换器属性 | [DropdownProps](/components/dropdown/#API) | - | - | 1.0.0 |
| hideOnSinglePage | 只有一页时是否隐藏分页组件 | boolean | false | `true` `false`| 1.0.0 |
| icons | 替换图标 | IIcon | {} | - | 1.0.0 |
| pageSize | 每页条目数 | number | - | - | 1.0.0 |
| pageSizeOptions | `pageSize` 切换器的下拉列表 | string\[] | \[`10`, `20`, `50`, `100`] | - | 1.0.0 |
| pageType | 分页类型,基础(basic)、单据(bill)、简化(simple)、较少(less)和精细(nicety)可选,默认是基础(basic) | string | `basic`| `basic` `bill` `simple` `less` `nicety` | 1.0.0 |
| showQuickJumper | 是否可以快速跳转至某页,默认为true, 当pageType为`bill`时,默认为false | boolean | true | `true` `false`| 1.0.0 |
| showSizeChanger | 是否展示 `pageSize` 切换器,当 `total` 大于 50 时默认为 true | boolean | - | `true` `false`| 1.0.0 |
| showTitle | 是否显示原生 tooltip 页码 | boolean | true | `true` `false`| 1.0.0 |
| showTotal | 是否显示总计,默认为false, 当pageType为`basic`时,默认为`page`, 当pageType为`nicety`时,默认为`row` | boolean \| string | false | `true` `false` `page` `row` `all` | 1.0.0 |
| total | 数据总量 | number | 0 | - | 1.0.0 |
| onChange | 页码改变的回调,参数是改变后的页码及每页条目数 | function(page, pageSize) | - | - | 1.0.0 |
| onShowSizeChange | pageSize 变化后的回调 | function(current, size) | - | - | 1.0.0 |

### IIcon

Expand Down
24 changes: 12 additions & 12 deletions components/pagination/pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@ export interface IIcons {
}

export interface IPaginationProps {
total?: number
bordered?: boolean
className?: string
current?: number
defaultCurrent?: number
defaultPageSize?: number
disabled?: boolean
dropdownProps?: DropDownProps
hideOnSinglePage?: boolean
icons?: Partial<IIcons>
pageSize?: number
pageSizeOptions?: Array<string | number>
prefixCls?: string
className?: string
disabled?: boolean
bordered?: boolean
pageType?: pageType
showQuickJumper?: boolean | { goButton?: React.ReactNode }
showSizeChanger?: boolean
showTitle?: boolean
showTotal?: boolean | totalType
defaultCurrent?: number
defaultPageSize?: number
showSizeChanger?: boolean
hideOnSinglePage?: boolean
style?: React.CSSProperties
dropdownProps?: DropDownProps
pageSizeOptions?: Array<string>
total?: number
onChange?: (page: number, pageSize?: number) => void
showQuickJumper?: boolean | { goButton?: React.ReactNode }
onShowSizeChange?: (current: number, size: number) => void
icons?: Partial<IIcons>
}

const Pagination: React.FC<IPaginationProps> = (props) => {
Expand Down

0 comments on commit a932185

Please sign in to comment.