Browse Source

fix: Table pagination position ts typo (#23681)

* fix: Table pagination postion ts typo

* fix
pull/23690/head
Tom Xu 5 years ago
committed by GitHub
parent
commit
a9d44593b3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      components/pagination/Pagination.tsx
  2. 6
      components/table/hooks/usePagination.ts
  3. 14
      components/table/interface.tsx

15
components/pagination/Pagination.tsx

@ -45,19 +45,10 @@ export interface PaginationProps {
showLessItems?: boolean;
}
export type PaginationPosition =
| 'top'
| 'bottom'
| 'both'
| 'topLeft'
| 'topCenter'
| 'topRight'
| 'bottomLeft'
| 'bottomCenter'
| 'bottomRight';
export type PaginationPosition = 'top' | 'bottom' | 'both';
export interface PaginationConfig extends PaginationProps {
position?: PaginationPosition[] | PaginationPosition;
position?: PaginationPosition;
}
export type PaginationLocale = any;
@ -68,7 +59,7 @@ export default class Pagination extends React.Component<PaginationProps, {}> {
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);

6
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,

14
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<RecordType> {
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[];
}

Loading…
Cancel
Save