2019-01-01 04:13:51 +00: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 03:33:27 +00:00
|
|
|
import { AntdComponent } from '../component';
|
|
|
|
import { Spin } from '../spin';
|
|
|
|
import { Pagination } from '../pagination';
|
|
|
|
import { Column } from './column';
|
|
|
|
import { ColumnGroup } from './column-group';
|
2020-08-17 13:12:17 +00:00
|
|
|
import { VNodeChild } from 'vue';
|
2019-01-01 04:13:51 +00:00
|
|
|
|
|
|
|
export declare class PaginationConfig extends Pagination {
|
2020-08-17 13:12:17 +00:00
|
|
|
position?: 'top' | 'bottom' | 'both';
|
2019-01-01 04:13:51 +00:00
|
|
|
}
|
|
|
|
|
2019-01-07 13:06:44 +00:00
|
|
|
export interface customSelection {
|
2019-01-01 04:13:51 +00: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
|
|
|
|
*/
|
2020-08-17 13:12:17 +00:00
|
|
|
text?: string | VNodeChild | JSX.Element;
|
2019-01-01 04:13:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* On Select
|
|
|
|
* @description Callback executed when this selection is clicked
|
|
|
|
* @default undefined
|
|
|
|
* @type Function
|
|
|
|
*/
|
2020-08-17 13:12:17 +00:00
|
|
|
onSelect?: (changeableRowKeys?: any[]) => any;
|
2019-01-01 04:13:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface TableRowSelection {
|
|
|
|
/**
|
|
|
|
* checkbox or radio
|
|
|
|
* @default 'checkbox'
|
|
|
|
* @type string
|
|
|
|
*/
|
2019-01-12 03:33:27 +00:00
|
|
|
type?: 'checkbox' | 'radio';
|
2019-01-01 04:13:51 +00: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 13:06:44 +00:00
|
|
|
selections?: boolean | customSelection[];
|
2019-01-01 04:13:51 +00: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
|
|
|
|
*/
|
2020-08-17 13:12:17 +00:00
|
|
|
columnTitle?: VNodeChild | JSX.Element;
|
2019-01-01 04:13:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback executed when selected rows change
|
|
|
|
* @type Function
|
|
|
|
*/
|
2019-01-12 03:33:27 +00:00
|
|
|
onChange?: (selectedRowKeys: Array<string | number>, selectedRows: object[]) => any;
|
2019-01-01 04:13:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback executed when select/deselect one row
|
|
|
|
* @type Function
|
|
|
|
*/
|
2019-01-12 03:33:27 +00:00
|
|
|
onSelect?: (record: any, selected: boolean, selectedRows: object[], nativeEvent: Event) => any;
|
2019-01-01 04:13:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback executed when select/deselect all rows
|
|
|
|
* @type Function
|
|
|
|
*/
|
2019-01-12 03:33:27 +00:00
|
|
|
onSelectAll?: (selected: boolean, selectedRows: object[], changeRows: object[]) => any;
|
2019-01-01 04:13:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback executed when row selection is inverted
|
|
|
|
* @type Function
|
|
|
|
*/
|
|
|
|
onSelectInvert?: (selectedRows: Object[]) => any;
|
|
|
|
}
|
|
|
|
|
2020-08-17 13:12:17 +00:00
|
|
|
export interface TableCustomRecord {
|
|
|
|
record?: any;
|
|
|
|
index?: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ExpandedRowRenderRecord extends TableCustomRecord {
|
|
|
|
indent?: number;
|
|
|
|
expanded?: boolean;
|
|
|
|
}
|
|
|
|
|
2019-01-01 04:13:51 +00:00
|
|
|
export declare class Table extends AntdComponent {
|
2019-01-19 10:56:33 +00:00
|
|
|
static Column: typeof Column;
|
|
|
|
static ColumnGroup: typeof ColumnGroup;
|
2019-01-01 04:13:51 +00:00
|
|
|
|
2020-08-17 13:12:17 +00:00
|
|
|
$props: {
|
|
|
|
/**
|
|
|
|
* 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 array
|
|
|
|
*/
|
|
|
|
columns: any[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Override default table elements
|
|
|
|
* @type object
|
|
|
|
*/
|
|
|
|
components?: object;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data record array to be displayed
|
|
|
|
* @type array
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
expandedRowRender?: (record?: ExpandedRowRenderRecord) => any;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Customize row expand Icon.
|
|
|
|
* @type Function | VNodeChild
|
|
|
|
*/
|
|
|
|
expandIcon?: Function | VNodeChild | JSX.Element;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether to expand row by clicking anywhere in the whole row
|
|
|
|
* @default false
|
|
|
|
* @type boolean
|
|
|
|
*/
|
|
|
|
expandRowByClick?: boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The index of `expandIcon` which column will be inserted when `expandIconAsCell` is false. default 0
|
|
|
|
*/
|
|
|
|
expandIconColumnIndex?: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Table footer renderer
|
|
|
|
* @type Function | VNodeChild
|
|
|
|
*/
|
|
|
|
footer?: Function | VNodeChild | JSX.Element;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 | VNodeChild | JSX.Element;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* i18n text including filter, sort, empty text, etc
|
|
|
|
* @default { filterConfirm: 'Ok', filterReset: 'Reset', emptyText: 'No Data' }
|
|
|
|
* @type object
|
|
|
|
*/
|
|
|
|
locale?: object;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pagination config or [Pagination] (/components/pagination/), hide it by setting it to false
|
|
|
|
* @type boolean | PaginationConfig
|
|
|
|
*/
|
|
|
|
pagination?: boolean | PaginationConfig;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Row's className
|
|
|
|
* @type Function
|
|
|
|
*/
|
|
|
|
rowClassName?: (record?: TableCustomRecord) => 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
|
|
|
|
*/
|
|
|
|
size?: 'default' | 'middle' | 'small' | 'large';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Table title renderer
|
|
|
|
* @type Function | ScopedSlot
|
|
|
|
*/
|
|
|
|
title?: Function | VNodeChild | JSX.Element;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set props on per header row
|
|
|
|
* @type Function
|
|
|
|
*/
|
|
|
|
customHeaderRow?: (column: any, index: number) => object;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set props on per row
|
|
|
|
* @type Function
|
|
|
|
*/
|
|
|
|
customRow?: (record: any, index: number) => object;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* `table-layout` attribute of table element
|
|
|
|
* `fixed` when header/columns are fixed, or using `column.ellipsis`
|
|
|
|
*
|
|
|
|
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout
|
|
|
|
* @version 1.5.0
|
|
|
|
*/
|
|
|
|
tableLayout?: 'auto' | 'fixed' | string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* the render container of dropdowns in table
|
|
|
|
* @param triggerNode
|
|
|
|
* @version 1.5.0
|
|
|
|
*/
|
|
|
|
getPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data can be changed again before rendering.
|
|
|
|
* The default configuration of general user empty data.
|
|
|
|
* You can configured globally through [ConfigProvider](https://antdv.com/components/config-provider-cn/)
|
|
|
|
*
|
|
|
|
* @version 1.5.4
|
|
|
|
*/
|
|
|
|
transformCellText?: Function;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback executed when pagination, filters or sorter is changed
|
|
|
|
* @param pagination
|
|
|
|
* @param filters
|
|
|
|
* @param sorter
|
|
|
|
* @param currentDataSource
|
|
|
|
*/
|
|
|
|
onChange?: (pagination: object, filters, sorter, { currentDataSource }) => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback executed when the row expand icon is clicked
|
|
|
|
*
|
|
|
|
* @param expanded
|
|
|
|
* @param record
|
|
|
|
*/
|
|
|
|
onExpand: (expanded, record) => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback executed when the expanded rows change
|
|
|
|
* @param expandedRows
|
|
|
|
*/
|
|
|
|
onExpandedRowsChange: (expandedRows: any) => void;
|
2019-01-01 04:13:51 +00:00
|
|
|
};
|
|
|
|
}
|