From ba971c4f2c0ebebf002167316906a4bc31db4937 Mon Sep 17 00:00:00 2001 From: zkwolf Date: Fri, 13 Nov 2020 10:08:06 +0800 Subject: [PATCH] fix: pagination type error #3159 (#3164) --- components/list/index.tsx | 9 +++++++-- components/table/interface.ts | 9 ++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/components/list/index.tsx b/components/list/index.tsx index c3a59b2ca..cc597a43c 100644 --- a/components/list/index.tsx +++ b/components/list/index.tsx @@ -1,4 +1,4 @@ -import { provide, inject, defineComponent, App, Plugin } from 'vue'; +import { provide, inject, defineComponent, App, Plugin, ExtractPropTypes } from 'vue'; import omit from 'omit.js'; import PropTypes, { withUndefined } from '../_util/vue-types'; import classNames from '../_util/classNames'; @@ -33,6 +33,8 @@ export const ListGridType = { export const ListSize = tuple('small', 'default', 'large'); +const paginationProps = PaginationConfig(); + export const ListProps = () => ({ bordered: PropTypes.looseBool, dataSource: PropTypes.array, @@ -42,7 +44,10 @@ export const ListProps = () => ({ loading: withUndefined(PropTypes.oneOfType([PropTypes.looseBool, PropTypes.object])), loadMore: PropTypes.any, pagination: withUndefined( - PropTypes.oneOfType([PropTypes.shape(PaginationConfig()).loose, PropTypes.looseBool]), + PropTypes.oneOfType([ + PropTypes.shape>>(paginationProps).loose, + PropTypes.looseBool, + ]), ), prefixCls: PropTypes.string, rowKey: PropTypes.any, diff --git a/components/table/interface.ts b/components/table/interface.ts index 59bb7a995..8e1a9fbaa 100644 --- a/components/table/interface.ts +++ b/components/table/interface.ts @@ -1,6 +1,6 @@ import { ExtractPropTypes, PropType } from 'vue'; import PropTypes, { withUndefined } from '../_util/vue-types'; -import { PaginationProps as getPaginationProps } from '../pagination'; +import { PaginationProps as getPaginationProps, PaginationConfig } from '../pagination'; import { SpinProps as getSpinProps } from '../spin'; import { Store } from './createStore'; import { tuple } from '../_util/type'; @@ -103,16 +103,15 @@ export const tableRowSelection = { export type SortOrder = 'descend' | 'ascend'; +const paginationProps = PaginationConfig(); + export const tableProps = { prefixCls: PropTypes.string, dropdownPrefixCls: PropTypes.string, rowSelection: PropTypes.oneOfType([PropTypes.shape(tableRowSelection).loose, Object]), pagination: withUndefined( PropTypes.oneOfType([ - PropTypes.shape({ - ...PaginationProps, - position: PropTypes.oneOf(tuple('top', 'bottom', 'both')), - }).loose, + PropTypes.shape>>(paginationProps).loose, PropTypes.looseBool, ]), ),