primevue-mirror/components/lib/treetable/TreeTable.d.ts

488 lines
13 KiB
TypeScript
Raw Normal View History

2023-03-01 12:46:45 +00:00
/**
*
* TreeTable is used to display hierarchical data in tabular format.
*
* [Live Demo](https://www.primevue.org/treetable/)
*
* @module treetable
*
*/
2022-09-06 12:03:37 +00:00
import { VNode } from 'vue';
import { TreeNode } from '../tree';
2023-03-01 12:46:45 +00:00
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
2023-03-01 12:46:45 +00:00
/**
* Custom treetable filter metadata.
*/
2022-09-06 12:03:37 +00:00
export interface TreeTableFilterMetaData {
/**
* Filter value
*/
value: any;
/**
* Filter match mode
*/
2023-03-27 08:09:36 +00:00
matchMode: 'startsWith' | 'contains' | 'notContains' | 'endsWith' | 'equals' | 'notEquals' | 'in' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'dateIs' | 'dateIsNot' | 'dateBefore' | 'dateAfter' | string | undefined;
2022-09-06 12:03:37 +00:00
}
2023-03-01 12:46:45 +00:00
/**
* Custom operator filter metadata.
*/
2022-09-06 12:03:37 +00:00
export interface TreeTableOperatorFilterMetaData {
/**
* Filter operator
*/
operator: string;
/**
* Array of filter meta datas.
* @see TreeTableFilterMetaData
*/
constraints: TreeTableFilterMetaData[];
}
2023-03-01 12:46:45 +00:00
/**
* Custom filter metadata.
*/
2022-09-06 12:03:37 +00:00
export interface TreeTableFilterMeta {
/**
* Filter keys
* @see TreeTableFilterMetaData
*/
[key: string]: string | TreeTableFilterMetaData | TreeTableOperatorFilterMetaData;
}
2023-03-01 12:46:45 +00:00
/**
* Custom sort event.
2023-03-06 20:35:39 +00:00
* @see {@link TreeTableEmits.sort}
2023-03-01 12:46:45 +00:00
*/
2022-09-06 12:03:37 +00:00
export interface TreeTableSortEvent {
/**
* Browser event.
*/
originalEvent: Event;
/**
* Index of first record
*/
first: number;
/**
* Number of rows to display in new page
*/
rows: number;
/**
* Field to sort against
*/
2023-03-01 12:46:45 +00:00
sortField: string | ((item: any) => string) | undefined;
2022-09-06 12:03:37 +00:00
/**
* Sort order as integer
*/
2023-03-01 12:46:45 +00:00
sortOrder: 1 | 0 | -1 | undefined | null;
2022-09-06 12:03:37 +00:00
/**
* MultiSort metadata
*/
2023-03-01 12:46:45 +00:00
multiSortMeta: TreeTableSortMeta[] | undefined | null;
2022-09-06 12:03:37 +00:00
/**
* Collection of active filters
* @see TreeTableFilterMeta
*/
filters: TreeTableFilterMeta;
/**
* Match modes per field
*/
2023-03-27 08:09:36 +00:00
filterMatchModes: 'startsWith' | 'contains' | 'notContains' | 'endsWith' | 'equals' | 'notEquals' | 'in' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'dateIs' | 'dateIsNot' | 'dateBefore' | 'dateAfter' | string | undefined;
2022-09-06 12:03:37 +00:00
}
/**
2023-03-01 12:46:45 +00:00
* Custom page event.
2023-03-06 20:35:39 +00:00
* @see {@link TreeTableEmits.sort}
2022-09-06 12:03:37 +00:00
* @extends TreeTableSortEvent
*/
export interface TreeTablePageEvent extends TreeTableSortEvent {
/**
* New page number
*/
page: number;
/**
* Total page count
*/
pageCount: number;
}
/**
2023-03-01 12:46:45 +00:00
* Custom filter event.
2023-03-06 20:35:39 +00:00
* @see {@link TreeTableEmits.sort}
2022-09-06 12:03:37 +00:00
* @extends TreeTableSortEvent
*/
export interface TreeTableFilterEvent extends TreeTableSortEvent {
/**
* Filtered collection (non-lazy only)
*/
filteredValue: any;
}
2023-03-01 12:46:45 +00:00
/**
* Custom sort metadata.
*/
2022-09-06 12:03:37 +00:00
export interface TreeTableSortMeta {
/**
* Column field
*/
field: string;
/**
* Column sort order
*/
2023-03-01 12:46:45 +00:00
order: 1 | 0 | -1 | undefined | null;
2022-09-06 12:03:37 +00:00
}
2023-03-01 12:46:45 +00:00
/**
* Custom expanded keys metadata.
*/
2022-09-06 12:03:37 +00:00
export interface TreeTableExpandedKeys {
/**
* Optional
*/
[key: string]: any;
}
2023-03-01 12:46:45 +00:00
/**
* Custom selection keys metadata.
*/
2022-09-06 12:03:37 +00:00
export interface TreeTableSelectionKeys {
/**
* Optional
*/
[key: string]: any;
}
2023-03-01 12:46:45 +00:00
/**
* Defines valid properties in TreeTable component.
*/
2022-09-06 12:03:37 +00:00
export interface TreeTableProps {
/**
* An array of treenodes.
*/
value?: TreeNode[] | undefined;
/**
* A map of keys to represent the state of the tree expansion state in controlled mode.
* @see TreeTableExpandedKeys
*/
expandedKeys?: TreeTableExpandedKeys;
/**
* A map of keys to control the selection state.
* @see TreeTableSelectionKeys
*/
selectionKeys?: TreeTableSelectionKeys;
/**
* Defines the selection mode.
*/
2023-03-01 12:46:45 +00:00
selectionMode?: 'single' | 'multiple' | 'checkbox' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Defines how multiple items can be selected, when true metaKey needs to be pressed to select or unselect an item and when set to false selection of each item can be toggled individually.
* On touch enabled devices, metaKeySelection is turned off automatically.
2023-03-01 12:46:45 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
metaKeySelection?: boolean | undefined;
/**
* Number of rows to display per page.
*/
rows?: number | undefined;
/**
* Index of the first row to be displayed.
2023-03-01 12:46:45 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
first?: number | undefined;
/**
* Number of total records, defaults to length of value when not defined.
*/
totalRecords?: number | undefined;
/**
* When specified as true, enables the pagination.
2023-03-10 14:00:58 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
paginator?: boolean | undefined;
/**
* Position of the paginator, options are 'top','bottom' or 'both'.
2023-03-01 12:46:45 +00:00
* @defaultValue bottom
2022-09-06 12:03:37 +00:00
*/
2023-03-01 12:46:45 +00:00
paginatorPosition?: 'top' | 'bottom' | 'both' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Whether to show it even there is only one page.
2023-03-01 12:46:45 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
alwaysShowPaginator?: boolean | undefined;
/**
2023-03-01 12:46:45 +00:00
* Template of the paginator. It can be customized using the template property using the predefined keys. Here are the available elements that can be placed inside a paginator in any order.
2022-09-06 12:03:37 +00:00
*
* - FirstPageLink
* - PrevPageLink
* - PageLinks
* - NextPageLink
* - LastPageLink
* - RowsPerPageDropdown
* - JumpToPageDropdown
* - JumpToPageInput
* - CurrentPageReport
2023-03-01 12:46:45 +00:00
*
2023-03-08 10:51:52 +00:00
* @defaultValue FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown
2022-09-06 12:03:37 +00:00
*/
paginatorTemplate?: string | undefined;
/**
* Number of page links to display.
2023-03-01 12:46:45 +00:00
* @defaultValue 5
2022-09-06 12:03:37 +00:00
*/
pageLinkSize?: number | undefined;
/**
* Array of integer values to display inside rows per page dropdown.
*/
rowsPerPageOptions?: number[] | undefined;
/**
2023-03-01 12:46:45 +00:00
* Template of the current page report element. It displays information about the pagination state.
2022-09-06 12:03:37 +00:00
*
* - {currentPage}
* - {totalPages}
* - {rows}
* - {first}
* - {last}
* - {totalRecords}
2023-03-01 12:46:45 +00:00
*
2023-03-08 11:02:08 +00:00
* @defaultValue '({currentPage} of {totalPages})'
2022-09-06 12:03:37 +00:00
*/
currentPageReportTemplate?: string | undefined;
/**
* Defines if data is loaded and interacted with in lazy manner.
2023-03-01 12:46:45 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
lazy?: boolean | undefined;
/**
* Displays a loader to indicate data load is in progress.
2023-03-01 12:46:45 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
loading?: boolean | undefined;
/**
* The icon to show while indicating data load is in progress.
2023-03-08 10:51:52 +00:00
* @defaultValue pi pi-spinner
2022-09-06 12:03:37 +00:00
*/
loadingIcon?: string | undefined;
/**
* When enabled, background of the rows change on hover.
2023-03-01 12:46:45 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
rowHover?: boolean | undefined;
/**
* Whether the cell widths scale according to their content or not.
2023-03-01 12:46:45 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
autoLayout?: boolean | undefined;
/**
* Property name or a getter function of a row data used for sorting by default.
*/
2023-03-01 12:46:45 +00:00
sortField?: string | ((item: any) => string) | undefined | undefined;
2022-09-06 12:03:37 +00:00
/**
* Order to sort the data by default.
*/
sortOrder?: number | undefined;
/**
* Default sort order of an unsorted column.
2023-03-01 12:46:45 +00:00
* @defaultValue 1
2022-09-06 12:03:37 +00:00
*/
defaultSortOrder?: number | undefined;
/**
* An array of SortMeta objects to sort the data by default in multiple sort mode.
*/
2023-03-01 12:46:45 +00:00
multiSortMeta?: TreeTableSortMeta[] | undefined | null;
2022-09-06 12:03:37 +00:00
/**
* Defines whether sorting works on single column or on multiple columns.
2023-03-08 10:51:52 +00:00
* @defaultValue single
2022-09-06 12:03:37 +00:00
*/
2023-03-01 12:46:45 +00:00
sortMode?: 'single' | 'multiple' | undefined;
2022-09-06 12:03:37 +00:00
/**
* When enabled, columns can have an un-sorted state.
2023-03-01 12:46:45 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
removableSort?: boolean | undefined;
/**
* Filters object with key-value pairs to define the filters.
* @see TreeTableFilterMeta
*/
filters?: TreeTableFilterMeta;
/**
* Mode for filtering.
2023-03-08 10:51:52 +00:00
* @defaultValue lenient
2022-09-06 12:03:37 +00:00
*/
2023-03-01 12:46:45 +00:00
filterMode?: 'lenient' | 'strict' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Locale to use in filtering. The default locale is the host environment's current locale.
*/
filterLocale?: string | undefined;
/**
* When enabled, columns can be resized using drag and drop.
2023-03-10 14:00:58 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
resizableColumns?: boolean | undefined;
/**
* Defines whether the overall table width should change on column resize.
2023-03-08 10:51:52 +00:00
* @defaultValue fit
2022-09-06 12:03:37 +00:00
*/
2023-03-01 12:46:45 +00:00
columnResizeMode?: 'fit' | 'expand' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Indentation factor as rem value for children nodes.
2023-03-01 12:46:45 +00:00
* @defaultValue 1
2022-09-06 12:03:37 +00:00
*/
indentation?: number | undefined;
/**
* Whether to show grid lines between cells.
2023-03-01 12:46:45 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
showGridlines?: boolean | undefined;
/**
* When specified, enables horizontal and/or vertical scrolling.
2023-03-01 12:46:45 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
scrollable?: boolean | undefined;
/**
* Height of the scroll viewport in fixed pixels or the 'flex' keyword for a dynamic size.
*/
2023-03-01 12:46:45 +00:00
scrollHeight?: 'flex' | string | undefined;
2022-09-06 12:03:37 +00:00
/**
* Orientation of the scrolling.
2023-03-08 10:51:52 +00:00
* @defaultValue vertical
2022-09-06 12:03:37 +00:00
*/
2023-03-01 12:46:45 +00:00
scrollDirection?: 'vertical' | 'horizontal' | 'both' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Defines the responsive mode, currently only option is scroll.
2023-03-08 10:51:52 +00:00
* @defaultValue stack
2022-09-06 12:03:37 +00:00
*/
2023-03-01 12:46:45 +00:00
responsiveLayout?: 'stack' | 'scroll' | undefined;
2022-12-08 11:04:25 +00:00
/**
* Props to pass to the table element.
*/
tableProps?: any | undefined;
2022-09-06 12:03:37 +00:00
}
2023-03-01 12:46:45 +00:00
/**
* Defines valid slots in TreeTable component.
*/
2022-09-06 12:03:37 +00:00
export interface TreeTableSlots {
/**
* Custom header template.
*/
2023-03-01 12:46:45 +00:00
header(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom footer template.
*/
2023-03-01 12:46:45 +00:00
footer(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom paginator start template.
*/
2023-03-01 12:46:45 +00:00
paginatorstart(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom paginator end template.
*/
2023-03-01 12:46:45 +00:00
paginatorend(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom empty template.
*/
2023-03-01 12:46:45 +00:00
empty(): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 12:46:45 +00:00
/**
* Defines valid emits in TreeTable component.
*/
export interface TreeTableEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the expanded keys change.
* @param {TreeNode} value - New expanded keys.
*/
2023-03-01 12:46:45 +00:00
'update:expandedKeys'(value: TreeTableExpandedKeys): void;
2022-09-06 12:03:37 +00:00
/**
* Emitted when the selection keys change.
* @param {TreeSelectionKeys} value - New selection keys.
*/
2023-03-01 12:46:45 +00:00
'update:selectionKeys'(event: TreeTableSelectionKeys): void;
2022-09-06 12:03:37 +00:00
/**
* Emitted when the first changes.
* @param {number} value - New value.
*/
2023-03-01 12:46:45 +00:00
'update:first'(value: number): void;
2022-09-06 12:03:37 +00:00
/**
* Emitted when the rows changes.
* @param {number} value - New value.
*/
2023-03-01 12:46:45 +00:00
'update:rows'(value: number): void;
2022-09-06 12:03:37 +00:00
/**
* Emitted when the sortField changes.
* @param {string} value - New value.
*/
2023-03-01 12:46:45 +00:00
'update:sortField'(value: string): void;
2022-09-06 12:03:37 +00:00
/**
* Emitted when the sortOrder changes.
* @param {number | undefined} value - New value.
*/
2023-03-01 12:46:45 +00:00
'update:sortOrder'(value: number | undefined): void;
2022-09-06 12:03:37 +00:00
/**
* Emitted when the multiSortMeta changes.
2023-03-01 12:46:45 +00:00
* @param {TreeTableSortMeta[] | undefined | null} value - New value.
2022-09-06 12:03:37 +00:00
*/
2023-03-01 12:46:45 +00:00
'update:multiSortMeta'(value: TreeTableSortMeta[] | undefined | null): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke on pagination. Sort and Filter information is also available for lazy loading implementation.
* @param {TreeTablePageEvent} event - Custom page event.
2022-09-14 11:26:01 +00:00
*/
2023-03-01 12:46:45 +00:00
page(event: TreeTablePageEvent): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke on sort. Page and Filter information is also available for lazy loading implementation.
* @param {TreeTableSortEvent} event - Custom sort event.
*/
2023-03-01 12:46:45 +00:00
sort(event: TreeTableSortEvent): void;
2022-09-06 12:03:37 +00:00
/**
* Event to emit after filtering, not triggered in lazy mode.
* @param {TreeTableFilterEvent} event - Custom filter event.
*/
2023-03-01 12:46:45 +00:00
filter(event: TreeTableFilterEvent): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when a node is selected.
* @param {TreeNode} node - Node instance.
*/
2023-03-01 12:46:45 +00:00
'node-select'(node: TreeNode): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when a node is unselected.
* @param {TreeNode} node - Node instance.
*/
2023-03-01 12:46:45 +00:00
'node-unselect'(node: TreeNode): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when a node is expanded.
* @param {TreeNode} node - Node instance.
*/
2023-03-01 12:46:45 +00:00
'node-expand'(node: TreeNode): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when a node is collapsed.
* @param {TreeNode} node - Node instance.
*/
2023-03-01 12:46:45 +00:00
'node-collapse'(node: TreeNode): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when a column is resized.
* @param {Event} event - Browser event.
*/
2023-03-01 12:46:45 +00:00
'column-resize-end'(event: Event): void;
}
2022-09-06 12:03:37 +00:00
2023-03-01 12:46:45 +00:00
/**
* **PrimeVue - TreeTable**
*
* _TreeTable is used to display hierarchical data in tabular format._
*
* [Live Demo](https://www.primevue.org/treetable/)
* --- ---
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
*
* @group Component
*/
2022-09-14 11:26:01 +00:00
declare class TreeTable extends ClassComponent<TreeTableProps, TreeTableSlots, TreeTableEmits> {}
2022-09-06 12:03:37 +00:00
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
TreeTable: GlobalComponentConstructor<TreeTable>;
2022-09-06 12:03:37 +00:00
}
}
export default TreeTable;