2019-01-01 12:13:51 +08:00
|
|
|
// Project: https://github.com/vueComponent/ant-design-vue
|
|
|
|
// Definitions by: akki-jat <https://github.com/akki-jat>
|
|
|
|
// Definitions: https://github.com/vueComponent/ant-design-vue/types
|
|
|
|
|
2019-01-12 11:33:27 +08:00
|
|
|
import { AntdComponent } from '../component';
|
|
|
|
import { Spin } from '../spin';
|
|
|
|
import { ScopedSlot, VNode } from 'vue/types/vnode';
|
|
|
|
import { Pagination } from '../pagination';
|
|
|
|
import { Column } from './column';
|
|
|
|
import { ColumnGroup } from './column-group';
|
2019-01-01 12:13:51 +08:00
|
|
|
|
|
|
|
export declare class PaginationConfig extends Pagination {
|
2019-01-12 11:33:27 +08:00
|
|
|
position: 'top' | 'bottom' | 'both';
|
2019-01-01 12:13:51 +08:00
|
|
|
}
|
|
|
|
|
2019-01-07 21:06:44 +08:00
|
|
|
export interface customSelection {
|
2019-01-01 12:13:51 +08:00
|
|
|
/**
|
|
|
|
* Key
|
|
|
|
* @description Unique key of this selection
|
|
|
|
* @default undefined
|
|
|
|
* @type string
|
|
|
|
*/
|
|
|
|
key?: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Text
|
|
|
|
* @description Display text of this selection
|
|
|
|
* @default undefined
|
|
|
|
* @type string | VNode
|
|
|
|
*/
|
|
|
|
text?: string | VNode;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* On Select
|
|
|
|
* @description Callback executed when this selection is clicked
|
|
|
|
* @default undefined
|
|
|
|
* @type Function
|
|
|
|
*/
|
|
|
|
onSelect?: (changeableRowKeys?: any) => any;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface TableRowSelection {
|
|
|
|
/**
|
|
|
|
* checkbox or radio
|
|
|
|
* @default 'checkbox'
|
|
|
|
* @type string
|
|
|
|
*/
|
2019-01-12 11:33:27 +08:00
|
|
|
type?: 'checkbox' | 'radio';
|
2019-01-01 12:13:51 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Controlled selected row keys
|
|
|
|
* @type string[]
|
|
|
|
*/
|
|
|
|
selectedRowKeys?: string[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Checkbox or Radio props
|
|
|
|
* @type Function
|
|
|
|
*/
|
|
|
|
getCheckboxProps?: (record: any) => any;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom selection config, only displays default selections when set to true
|
|
|
|
* @type boolean | object[]
|
|
|
|
*/
|
2019-01-07 21:06:44 +08:00
|
|
|
selections?: boolean | customSelection[];
|
2019-01-01 12:13:51 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the default Select All and Select Invert selections
|
|
|
|
* @default false
|
|
|
|
* @type boolean
|
|
|
|
*/
|
|
|
|
hideDefaultSelections?: boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fixed selection column on the left
|
|
|
|
* @type boolean
|
|
|
|
*/
|
|
|
|
fixed?: boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the width of the selection column
|
|
|
|
* @type string | number
|
|
|
|
*/
|
|
|
|
columnWidth?: string | number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the title of the selection column
|
|
|
|
* @type string | VNode
|
|
|
|
*/
|
|
|
|
columnTitle?: string | VNode;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback executed when selected rows change
|
|
|
|
* @type Function
|
|
|
|
*/
|
2019-01-12 11:33:27 +08:00
|
|
|
onChange?: (selectedRowKeys: Array<string | number>, selectedRows: object[]) => any;
|
2019-01-01 12:13:51 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback executed when select/deselect one row
|
|
|
|
* @type Function
|
|
|
|
*/
|
2019-01-12 11:33:27 +08:00
|
|
|
onSelect?: (record: any, selected: boolean, selectedRows: object[], nativeEvent: Event) => any;
|
2019-01-01 12:13:51 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback executed when select/deselect all rows
|
|
|
|
* @type Function
|
|
|
|
*/
|
2019-01-12 11:33:27 +08:00
|
|
|
onSelectAll?: (selected: boolean, selectedRows: object[], changeRows: object[]) => any;
|
2019-01-01 12:13:51 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback executed when row selection is inverted
|
|
|
|
* @type Function
|
|
|
|
*/
|
|
|
|
onSelectInvert?: (selectedRows: Object[]) => any;
|
|
|
|
}
|
|
|
|
|
|
|
|
export declare class Table extends AntdComponent {
|
2019-01-19 18:56:33 +08:00
|
|
|
static Column: typeof Column;
|
|
|
|
static ColumnGroup: typeof ColumnGroup;
|
2019-01-01 12:13:51 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether to show all table borders
|
|
|
|
* @default false
|
|
|
|
* @type boolean
|
|
|
|
*/
|
|
|
|
bordered: boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The column contains children to display
|
|
|
|
* @default 'children'
|
|
|
|
* @type string | string[]
|
|
|
|
*/
|
|
|
|
childrenColumnName: string | string[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Columns of table
|
|
|
|
* @type any
|
|
|
|
*/
|
|
|
|
columns: any;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Override default table elements
|
|
|
|
* @type object
|
|
|
|
*/
|
|
|
|
components: object;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data record array to be displayed
|
|
|
|
* @type any
|
|
|
|
*/
|
|
|
|
dataSource: any;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Expand all rows initially
|
|
|
|
* @default false
|
|
|
|
* @type boolean
|
|
|
|
*/
|
|
|
|
defaultExpandAllRows: boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initial expanded row keys
|
|
|
|
* @type string[]
|
|
|
|
*/
|
|
|
|
defaultExpandedRowKeys: string[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Current expanded row keys
|
|
|
|
* @type string[]
|
|
|
|
*/
|
|
|
|
expandedRowKeys: string[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Expanded container render for each row
|
|
|
|
* @type Function
|
|
|
|
*/
|
2019-01-12 11:33:27 +08:00
|
|
|
expandedRowRender: (record: any, index: number, indent: number, expanded: boolean) => any;
|
2019-01-01 12:13:51 +08:00
|
|
|
|
2019-01-05 18:09:27 +08:00
|
|
|
/**
|
|
|
|
* Customize row expand Icon.
|
|
|
|
* @type Function | ScopedSlot
|
|
|
|
*/
|
|
|
|
expandIcon: Function | ScopedSlot;
|
|
|
|
|
2019-01-01 12:13:51 +08:00
|
|
|
/**
|
|
|
|
* Whether to expand row by clicking anywhere in the whole row
|
|
|
|
* @default false
|
|
|
|
* @type boolean
|
|
|
|
*/
|
|
|
|
expandRowByClick: boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Table footer renderer
|
|
|
|
* @type Function | ScopedSlot
|
|
|
|
*/
|
|
|
|
footer: Function | ScopedSlot;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indent size in pixels of tree data
|
|
|
|
* @default 15
|
|
|
|
* @type number
|
|
|
|
*/
|
|
|
|
indentSize: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Loading status of table
|
|
|
|
* @default false
|
|
|
|
* @type boolean | object
|
|
|
|
*/
|
|
|
|
loading: boolean | Spin;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* i18n text including filter, sort, empty text, etc
|
|
|
|
* @default { filterConfirm: 'Ok', filterReset: 'Reset', emptyText: 'No Data' }
|
|
|
|
* @type object
|
|
|
|
*/
|
|
|
|
locale: object;
|
|
|
|
|
|
|
|
/**
|
2019-02-16 16:51:21 +08:00
|
|
|
* Pagination config or [Pagination] (/components/pagination/), hide it by setting it to false
|
2019-01-01 12:13:51 +08:00
|
|
|
* @type boolean | PaginationConfig
|
|
|
|
*/
|
|
|
|
pagination: boolean | PaginationConfig;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Row's className
|
|
|
|
* @type Function
|
|
|
|
*/
|
|
|
|
rowClassName: (record: any, index: number) => string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Row's unique key, could be a string or function that returns a string
|
|
|
|
* @default 'key'
|
|
|
|
* @type string | Function
|
|
|
|
*/
|
|
|
|
rowKey: string | Function;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Row selection config
|
|
|
|
* @type object
|
|
|
|
*/
|
|
|
|
rowSelection: TableRowSelection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set horizontal or vertical scrolling, can also be used to specify the width and height of the scroll area.
|
|
|
|
* It is recommended to set a number for x, if you want to set it to true,
|
|
|
|
* you need to add style .ant-table td { white-space: nowrap; }.
|
|
|
|
* @type object
|
|
|
|
*/
|
|
|
|
scroll: { x: number | true; y: number };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether to show table header
|
|
|
|
* @default true
|
|
|
|
* @type boolean
|
|
|
|
*/
|
|
|
|
showHeader: boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Size of table
|
|
|
|
* @default 'default'
|
|
|
|
* @type string
|
|
|
|
*/
|
2019-01-12 11:33:27 +08:00
|
|
|
size: 'default' | 'middle' | 'small' | 'large';
|
2019-01-01 12:13:51 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Table title renderer
|
|
|
|
* @type Function | ScopedSlot
|
|
|
|
*/
|
|
|
|
title: Function | ScopedSlot;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set props on per header row
|
|
|
|
* @type Function
|
|
|
|
*/
|
|
|
|
customHeaderRow: (
|
|
|
|
column: any,
|
2019-01-12 11:33:27 +08:00
|
|
|
index: number,
|
2019-01-01 12:13:51 +08:00
|
|
|
) => {
|
|
|
|
props: object;
|
|
|
|
attrs: object;
|
|
|
|
on: object;
|
|
|
|
class: object;
|
|
|
|
style: object;
|
|
|
|
nativeOn: object;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set props on per row
|
|
|
|
* @type Function
|
|
|
|
*/
|
|
|
|
customRow: (
|
|
|
|
record: any,
|
2019-01-12 11:33:27 +08:00
|
|
|
index: number,
|
2019-01-01 12:13:51 +08:00
|
|
|
) => {
|
|
|
|
props: object;
|
|
|
|
attrs: object;
|
|
|
|
on: object;
|
|
|
|
class: object;
|
|
|
|
style: object;
|
|
|
|
nativeOn: object;
|
|
|
|
};
|
|
|
|
}
|