mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-04 21:27:52 +08:00
3b378ad58f
* add typings into package.json * add typings for global instance api * add common component definition * add layout components' definition * add icons definition * add component size definition * add component description * add button definition * add radio definition * add checkbox definition * add input definitions * add input-number definition * add select definition * add cascader definition * add switch definition * add slider definition * add time picker definition * add date picker definition * add upload definition * add rate definition * add color picker definition * add form definition * add tooltip definition * add table definition * rename TextAlignment to Horizontal alignment * add tag definition * add progress definition * add tree definition * add pagination definition * add badge definition * add alert definition * fix typo * Loading: add definition * Message: add definition * Loading: remove unnecessary declare keyword * MessageBox: add definition * Notification: add definition * Menu: add definition * Tabs: add definition * Breadcrumb: add definition * Dropdown: add definition * Steps: add definition * Dialog: add definition * Popover: add definition * Card: add definition * Carousel: add definition * Collapse: add definition * Loading: update description * some $message method params should be optional * Select: update definition * DatePicker: update definition
100 lines
3.3 KiB
TypeScript
100 lines
3.3 KiB
TypeScript
import { CreateElement, VNode } from 'vue'
|
|
import { ElementUIComponent, ElementUIHorizontalAlignment } from './component'
|
|
|
|
export type TableColumnType = 'default' | 'selection' | 'index' | 'expand'
|
|
export type TableColumnFixedType = 'left' | 'right'
|
|
|
|
// TODO: complete type here
|
|
export type TableColumn = any
|
|
|
|
/** Data used in renderHeader function */
|
|
export interface RenderHeaderData {
|
|
/** The column that is current rendering */
|
|
column: any,
|
|
|
|
/** The index of the rendering column */
|
|
$index: number
|
|
}
|
|
|
|
/** Filter Object */
|
|
export interface TableColumnFilter {
|
|
/** The text to show in the filter's panel */
|
|
text: string,
|
|
|
|
/** The value of the filter */
|
|
value: any
|
|
}
|
|
|
|
/** TableColumn Component */
|
|
export declare class ElTableColumn extends ElementUIComponent {
|
|
/** Type of the column. If set to `selection`, the column will display checkbox. If set to `index`, the column will display index of the row (staring from 1). If set to `expand`, the column will display expand icon. */
|
|
type: TableColumnType
|
|
|
|
/** Column label */
|
|
label: string
|
|
|
|
/** Column's key. If you need to use the filter-change event, you need this attribute to identify which column is being filtered */
|
|
columnKey: string
|
|
|
|
/** Field name. You can also use its alias: property */
|
|
prop: string
|
|
|
|
/** Column width */
|
|
width: string
|
|
|
|
/** Column minimum width. Columns with `width` has a fixed width, while columns with `min-width` has a width that is distributed in proportion */
|
|
minWidth: string
|
|
|
|
/** Whether column is fixed at left/right. Will be fixed at left if `true` */
|
|
fixed: boolean | TableColumnFixedType
|
|
|
|
/** Render function for table header of this column */
|
|
renderHeader: (h: CreateElement, data: RenderHeaderData) => VNode | string
|
|
|
|
/** Whether column can be sorted */
|
|
sortable: boolean
|
|
|
|
/** Sorting method. Works when `sortable` is `true` */
|
|
sortMethod: (a: any, b: any) => number
|
|
|
|
/** Whether column width can be resized. Works when border of `el-table` is `true` */
|
|
resizable: boolean
|
|
|
|
/** Function that formats content */
|
|
formatter: (row: object, column: TableColumn) => any
|
|
|
|
/** Whether to hide extra content and show them in a tooltip when hovering on the cell */
|
|
showOverflowTooltip: boolean
|
|
|
|
/** Alignment */
|
|
align: ElementUIHorizontalAlignment
|
|
|
|
/** Alignment of the table header. If omitted, the value of the `align` attribute will be applied */
|
|
headerAlign: ElementUIHorizontalAlignment
|
|
|
|
/** Class name of cells in the column */
|
|
className: string
|
|
|
|
/** Class name of the label of this column */
|
|
labelClassName: string
|
|
|
|
/** Function that determines if a certain row can be selected, works when `type` is `'selection'` */
|
|
selectable: (row: object, index: number) => boolean
|
|
|
|
/** Whether to reserve selection after data refreshing, works when `type` is `'selection'` */
|
|
reserveSelection: boolean
|
|
|
|
/** An array of data filtering options */
|
|
filters: TableColumnFilter[]
|
|
|
|
/** Whether data filtering supports multiple options */
|
|
filterMultiple: Boolean
|
|
|
|
/** Data filtering method. If `filter-multiple` is on, this method will be called multiple times for each row, and a row will display if one of the calls returns `true` */
|
|
filterMethod: (value: any, row: object) => boolean
|
|
|
|
// TODO: complete type here
|
|
/** Filter value for selected data, might be useful when table header is rendered with `render-header` */
|
|
filteredValue: any[]
|
|
}
|