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; showLessItems?: boolean;
} }
export type PaginationPosition = export type PaginationPosition = 'top' | 'bottom' | 'both';
| 'top'
| 'bottom'
| 'both'
| 'topLeft'
| 'topCenter'
| 'topRight'
| 'bottomLeft'
| 'bottomCenter'
| 'bottomRight';
export interface PaginationConfig extends PaginationProps { export interface PaginationConfig extends PaginationProps {
position?: PaginationPosition[] | PaginationPosition; position?: PaginationPosition;
} }
export type PaginationLocale = any; export type PaginationLocale = any;
@ -68,7 +59,7 @@ export default class Pagination extends React.Component<PaginationProps, {}> {
private inferredSmall: boolean = false; private inferredSmall: boolean = false;
componentDidMount() { componentDidMount() {
this.token = ResponsiveObserve.subscribe((screens) => { this.token = ResponsiveObserve.subscribe(screens => {
const { xs } = screens; const { xs } = screens;
const { size, responsive } = this.props; const { size, responsive } = this.props;
const inferredSmall = !!(xs && !size && responsive); const inferredSmall = !!(xs && !size && responsive);

6
components/table/hooks/usePagination.ts

@ -1,12 +1,12 @@
import { useState } from 'react'; import { useState } from 'react';
import { PaginationProps, PaginationConfig } from '../../pagination'; import { PaginationProps } from '../../pagination';
import { TablePaginationConfig } from '../interface'; import { TablePaginationConfig } from '../interface';
export const DEFAULT_PAGE_SIZE = 10; export const DEFAULT_PAGE_SIZE = 10;
export function getPaginationParam( export function getPaginationParam(
pagination: PaginationConfig | boolean | undefined, pagination: TablePaginationConfig | boolean | undefined,
mergedPagination: PaginationConfig, mergedPagination: TablePaginationConfig,
) { ) {
const param: any = { const param: any = {
current: mergedPagination.current, current: mergedPagination.current,

14
components/table/interface.tsx

@ -5,7 +5,7 @@ import {
ExpandableConfig, ExpandableConfig,
} from 'rc-table/lib/interface'; } from 'rc-table/lib/interface';
import { CheckboxProps } from '../checkbox'; import { CheckboxProps } from '../checkbox';
import { PaginationConfig } from '../pagination'; import { PaginationProps } from '../pagination';
import { INTERNAL_SELECTION_ITEM } from './hooks/useSelection'; import { INTERNAL_SELECTION_ITEM } from './hooks/useSelection';
export { GetRowKey, ExpandableConfig }; export { GetRowKey, ExpandableConfig };
@ -161,6 +161,14 @@ export interface SorterResult<RecordType> {
export type GetPopupContainer = (triggerNode: HTMLElement) => HTMLElement; export type GetPopupContainer = (triggerNode: HTMLElement) => HTMLElement;
export interface TablePaginationConfig extends PaginationConfig { type TablePaginationPosition =
// position?: 'top' | 'bottom' | 'both'; | 'topLeft'
| 'topCenter'
| 'topRight'
| 'bottomLeft'
| 'bottomCenter'
| 'bottomRight';
export interface TablePaginationConfig extends PaginationProps {
position?: TablePaginationPosition[];
} }

Loading…
Cancel
Save