From e9a1d10dbb19bbad54bf0adaf9373b438fea7464 Mon Sep 17 00:00:00 2001 From: hengkx Date: Mon, 27 Apr 2020 21:59:21 +0800 Subject: [PATCH 1/2] fix: Table pagination postion ts typo --- components/pagination/Pagination.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/components/pagination/Pagination.tsx b/components/pagination/Pagination.tsx index 9711d6ef2273..c633ad0a63e8 100644 --- a/components/pagination/Pagination.tsx +++ b/components/pagination/Pagination.tsx @@ -46,9 +46,6 @@ export interface PaginationProps { } export type PaginationPosition = - | 'top' - | 'bottom' - | 'both' | 'topLeft' | 'topCenter' | 'topRight' @@ -57,7 +54,7 @@ export type PaginationPosition = | 'bottomRight'; export interface PaginationConfig extends PaginationProps { - position?: PaginationPosition[] | PaginationPosition; + position?: PaginationPosition[]; } export type PaginationLocale = any; @@ -68,7 +65,7 @@ export default class Pagination extends React.Component { private inferredSmall: boolean = false; componentDidMount() { - this.token = ResponsiveObserve.subscribe((screens) => { + this.token = ResponsiveObserve.subscribe(screens => { const { xs } = screens; const { size, responsive } = this.props; const inferredSmall = !!(xs && !size && responsive); From 8d890811c9ffd681f7aa4de605f66bd566dd67c9 Mon Sep 17 00:00:00 2001 From: hengkx Date: Mon, 27 Apr 2020 22:15:50 +0800 Subject: [PATCH 2/2] fix --- components/pagination/Pagination.tsx | 10 ++-------- components/table/hooks/usePagination.ts | 6 +++--- components/table/interface.tsx | 14 +++++++++++--- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/components/pagination/Pagination.tsx b/components/pagination/Pagination.tsx index c633ad0a63e8..b0466215442e 100644 --- a/components/pagination/Pagination.tsx +++ b/components/pagination/Pagination.tsx @@ -45,16 +45,10 @@ export interface PaginationProps { showLessItems?: boolean; } -export type PaginationPosition = - | 'topLeft' - | 'topCenter' - | 'topRight' - | 'bottomLeft' - | 'bottomCenter' - | 'bottomRight'; +export type PaginationPosition = 'top' | 'bottom' | 'both'; export interface PaginationConfig extends PaginationProps { - position?: PaginationPosition[]; + position?: PaginationPosition; } export type PaginationLocale = any; diff --git a/components/table/hooks/usePagination.ts b/components/table/hooks/usePagination.ts index d55f3aa6d51d..079ed10a111d 100644 --- a/components/table/hooks/usePagination.ts +++ b/components/table/hooks/usePagination.ts @@ -1,12 +1,12 @@ import { useState } from 'react'; -import { PaginationProps, PaginationConfig } from '../../pagination'; +import { PaginationProps } from '../../pagination'; import { TablePaginationConfig } from '../interface'; export const DEFAULT_PAGE_SIZE = 10; export function getPaginationParam( - pagination: PaginationConfig | boolean | undefined, - mergedPagination: PaginationConfig, + pagination: TablePaginationConfig | boolean | undefined, + mergedPagination: TablePaginationConfig, ) { const param: any = { current: mergedPagination.current, diff --git a/components/table/interface.tsx b/components/table/interface.tsx index d51c58c8add9..60efbf02b605 100644 --- a/components/table/interface.tsx +++ b/components/table/interface.tsx @@ -5,7 +5,7 @@ import { ExpandableConfig, } from 'rc-table/lib/interface'; import { CheckboxProps } from '../checkbox'; -import { PaginationConfig } from '../pagination'; +import { PaginationProps } from '../pagination'; import { INTERNAL_SELECTION_ITEM } from './hooks/useSelection'; export { GetRowKey, ExpandableConfig }; @@ -161,6 +161,14 @@ export interface SorterResult { export type GetPopupContainer = (triggerNode: HTMLElement) => HTMLElement; -export interface TablePaginationConfig extends PaginationConfig { - // position?: 'top' | 'bottom' | 'both'; +type TablePaginationPosition = + | 'topLeft' + | 'topCenter' + | 'topRight' + | 'bottomLeft' + | 'bottomCenter' + | 'bottomRight'; + +export interface TablePaginationConfig extends PaginationProps { + position?: TablePaginationPosition[]; }