@ -1,21 +1,21 @@
import { ExtractPropTypes , PropType } from 'vue' ;
import PropTypes , { withUndefined } from '../_util/vue-types' ;
import { PaginationProps as getPaginationProps } from '../pagination' ;
import { SpinProps as getSpinProps } from '../spin' ;
import { Store } from './createStore' ;
import { tuple } from '../_util/type' ;
import { ExtractPropTypes } from 'vue' ;
const PaginationProps = getPaginationProps ( ) ;
const SpinProps = getSpinProps ( ) ;
// export type CompareFn<T> = ((a: T, b: T) => number);
export type CompareFn < T > = ( a : T , b : T , sortOrder? : SortOrder ) = > number ;
export const ColumnFilterItem = PropTypes . shape ( {
text : PropTypes.string ,
value : PropTypes.string ,
children : PropTypes.array ,
} ) . loose ;
export const C olumnProps = {
export const c olumnProps = {
title : PropTypes.VNodeChild ,
key : PropTypes.oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
dataIndex : PropTypes.string ,
@ -52,7 +52,7 @@ export const ColumnProps = {
// onHeaderCell?: (props: ColumnProps<T>) => any;
} ;
export type I ColumnProps = Partial < ExtractPropTypes < typeof C olumnProps> > ;
export type ColumnProps = Partial < ExtractPropTypes < typeof c olumnProps> > ;
export interface TableComponents {
table? : any ;
@ -80,10 +80,10 @@ export const TableLocale = PropTypes.shape({
collapse : PropTypes.string ,
} ) . loose ;
export const RowSelectionType = PropTypes . oneOf ( [ 'checkbox' , 'radio' ] ) ;
export const RowSelectionType = PropTypes . oneOf ( tuple ( 'checkbox' , 'radio' ) ) ;
// export type SelectionSelectFn<T> = (record: T, selected: boolean, selectedRows: Object[]) => any;
export const T ableRowSelection = {
export const t ableRowSelection = {
type : RowSelectionType ,
selectedRowKeys : PropTypes.array ,
// onChange?: (selectedRowKeys: string[] | number[], selectedRows: Object[]) => any;
@ -101,10 +101,12 @@ export const TableRowSelection = {
columnTitle : PropTypes.any ,
} ;
export const TableProps = {
export type SortOrder = 'descend' | 'ascend' ;
export const tableProps = {
prefixCls : PropTypes.string ,
dropdownPrefixCls : PropTypes.string ,
rowSelection : PropTypes.oneOfType ( [ PropTypes . shape ( T ableRowSelection) . loose , Object ] ) ,
rowSelection : PropTypes.oneOfType ( [ PropTypes . shape ( t ableRowSelection) . loose , Object ] ) ,
pagination : withUndefined (
PropTypes . oneOfType ( [
PropTypes . shape ( {
@ -117,7 +119,9 @@ export const TableProps = {
size : PropTypes.oneOf ( tuple ( 'default' , 'middle' , 'small' , 'large' ) ) ,
dataSource : PropTypes.array ,
components : PropTypes.object ,
columns : PropTypes.array ,
columns : {
type : Array as PropType < ColumnProps > ,
} ,
rowKey : PropTypes.oneOfType ( [ PropTypes . string , PropTypes . func ] ) ,
rowClassName : PropTypes.func ,
expandedRowRender : PropTypes.any ,
@ -137,10 +141,18 @@ export const TableProps = {
showHeader : PropTypes.looseBool ,
footer : PropTypes.func ,
title : PropTypes.func ,
scroll : PropTypes.object ,
scroll : {
type : Object as PropType < {
x? : boolean | number | string ;
y? : boolean | number | string ;
scrollToFirstRowOnChange? : boolean ;
} > ,
} ,
childrenColumnName : PropTypes.oneOfType ( [ PropTypes . array , PropTypes . string ] ) ,
bodyStyle : PropTypes.any ,
sortDirections : PropTypes.array ,
bodyStyle : PropTypes.style ,
sortDirections : {
type : Array as PropType < SortOrder [ ] > ,
} ,
tableLayout : PropTypes.string ,
getPopupContainer : PropTypes.func ,
expandIcon : PropTypes.func ,
@ -153,9 +165,9 @@ export const TableProps = {
// children?: React.ReactNode;
} ;
export type I TableRowSelection = Partial < ExtractPropTypes < typeof T ableRowSelection> > ;
export type TableRowSelection = Partial < ExtractPropTypes < typeof t ableRowSelection> > ;
export type I TableProps = Partial < ExtractPropTypes < typeof T ableProps> > ;
export type TableProps = Partial < ExtractPropTypes < typeof t ableProps> > ;
export interface TableStateFilters {
[ key : string ] : string [ ] ;
@ -164,9 +176,9 @@ export interface TableStateFilters {
export interface TableState {
pagination? : Partial < ExtractPropTypes < typeof PaginationProps > > ;
filters? : TableStateFilters ;
sortColumn? : Partial < ExtractPropTypes < typeof ColumnProps > > | null ;
sortColumn? : ColumnProps | null ;
sortOrder? : string ;
columns? : I ColumnProps[ ] ;
columns? : ColumnProps [ ] ;
}
// export type SelectionItemSelectFn = (key: string[]) => any;