fix: pagination type error #3159 (#3164)

pull/3165/head
zkwolf 2020-11-13 10:08:06 +08:00 committed by GitHub
parent e29ad47995
commit ba971c4f2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View File

@ -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<Partial<ExtractPropTypes<typeof paginationProps>>>(paginationProps).loose,
PropTypes.looseBool,
]),
),
prefixCls: PropTypes.string,
rowKey: PropTypes.any,

View File

@ -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<Partial<ExtractPropTypes<typeof paginationProps>>>(paginationProps).loose,
PropTypes.looseBool,
]),
),