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