2023-03-01 11:45:15 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* DataView displays data in grid or list layout with pagination and sorting features.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/dataview/)
|
|
|
|
*
|
|
|
|
* @module dataview
|
|
|
|
*
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
import { VNode } from 'vue';
|
|
|
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
|
|
|
|
2023-03-01 11:45:15 +00:00
|
|
|
/**
|
|
|
|
* Custom change event.
|
|
|
|
* @see page
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface DataViewPageEvent {
|
|
|
|
/**
|
|
|
|
* New page number
|
|
|
|
*/
|
|
|
|
page: number;
|
|
|
|
/**
|
|
|
|
* Index of first record
|
|
|
|
*/
|
|
|
|
first: number;
|
|
|
|
/**
|
|
|
|
* Number of rows to display in new page
|
|
|
|
*/
|
|
|
|
rows: number;
|
|
|
|
/**
|
|
|
|
* Total number of pages
|
|
|
|
*/
|
|
|
|
pageCount: number;
|
|
|
|
}
|
|
|
|
|
2023-03-01 11:45:15 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in DataView component. In addition to these, all properties of HTMLDivElement can be used in this component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface DataViewProps {
|
|
|
|
/**
|
|
|
|
* An array of objects to display.
|
|
|
|
*/
|
|
|
|
value?: any[] | undefined;
|
|
|
|
/**
|
|
|
|
* Layout of the items, valid values are 'list' and 'grid'.
|
2023-03-03 08:18:55 +00:00
|
|
|
* @defaultValue 'list'
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 11:45:15 +00:00
|
|
|
layout?: 'list' | 'grid' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Number of rows to display per page.
|
2023-03-01 11:45:15 +00:00
|
|
|
* @defaultValue 0
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
rows?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Index of the first record to render.
|
2023-03-01 11:45:15 +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-01 11:45:15 +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-03 08:18:55 +00:00
|
|
|
* @defaultValue 'bottom'
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 11:45:15 +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 11:45:15 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
alwaysShowPaginator?: boolean | undefined;
|
|
|
|
/**
|
2023-03-01 11:45:15 +00:00
|
|
|
* Template of the paginator. It can be customized using the template property using the predefined keys,
|
2022-09-06 12:03:37 +00:00
|
|
|
*
|
|
|
|
* - FirstPageLink
|
|
|
|
* - PrevPageLink
|
|
|
|
* - PageLinks
|
|
|
|
* - NextPageLink
|
|
|
|
* - LastPageLink
|
|
|
|
* - RowsPerPageDropdown
|
|
|
|
* - JumpToPageDropdown
|
|
|
|
* - JumpToPageInput
|
|
|
|
* - CurrentPageReport
|
2023-03-01 11:45:15 +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 11:45:15 +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 11:45:15 +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 11:45:15 +00:00
|
|
|
*
|
2023-03-03 08:18:55 +00:00
|
|
|
* @defaultValue '({currentPage} of {totalPages})'
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
currentPageReportTemplate?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Property name or a getter function of data to use in sorting by default.
|
|
|
|
*/
|
2023-03-01 11:45:15 +00:00
|
|
|
sortField?: string | ((item: any) => string) | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Order to sort the data by default.
|
|
|
|
*/
|
|
|
|
sortOrder?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Defines if data is loaded and interacted with in lazy manner.
|
2023-03-01 11:45:15 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
lazy?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Name of the data that uniquely identifies the a record in the data.
|
|
|
|
*/
|
|
|
|
dataKey: string | undefined;
|
|
|
|
}
|
|
|
|
|
2023-03-01 11:45:15 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in DataView component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface DataViewSlots {
|
|
|
|
/**
|
|
|
|
* Custom header template.
|
|
|
|
*/
|
2023-03-01 11:45:15 +00:00
|
|
|
header(): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom footer template.
|
|
|
|
*/
|
2023-03-01 11:45:15 +00:00
|
|
|
footer(): VNode[];
|
2022-09-14 11:26:01 +00:00
|
|
|
/**
|
2022-09-06 12:03:37 +00:00
|
|
|
* Custom empty template.
|
|
|
|
*/
|
2023-03-01 11:45:15 +00:00
|
|
|
empty(): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom paginator start template.
|
|
|
|
*/
|
2023-03-01 11:45:15 +00:00
|
|
|
paginatorstart(): VNode[];
|
2022-09-14 11:26:01 +00:00
|
|
|
/**
|
2022-09-06 12:03:37 +00:00
|
|
|
* Custom paginator end template.
|
|
|
|
*/
|
2023-03-01 11:45:15 +00:00
|
|
|
paginatorend(): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom list template.
|
|
|
|
* @param {Object} scope - list slot's params.
|
|
|
|
*/
|
2023-03-01 11:45:15 +00:00
|
|
|
list(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Value of the component
|
|
|
|
*/
|
|
|
|
data: any;
|
|
|
|
/**
|
|
|
|
* Index of the grid
|
|
|
|
*/
|
|
|
|
index: number;
|
2023-03-01 11:45:15 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom list template.
|
|
|
|
* @param {Object} scope - list slot's params.
|
|
|
|
*/
|
2023-03-01 11:45:15 +00:00
|
|
|
grid(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Value of the component
|
|
|
|
*/
|
|
|
|
data: any;
|
|
|
|
/**
|
|
|
|
* Index of the grid
|
|
|
|
*/
|
|
|
|
index: number;
|
2023-03-01 11:45:15 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 11:45:15 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in DataView component.
|
|
|
|
*/
|
|
|
|
export interface DataViewEmits {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the first changes.
|
|
|
|
* @param {number} value - New value.
|
|
|
|
*/
|
2023-03-01 11:45:15 +00:00
|
|
|
'update:first'(value: number): void;
|
2022-09-14 11:26:01 +00:00
|
|
|
/**
|
2022-09-06 12:03:37 +00:00
|
|
|
* Emitted when the rows changes.
|
|
|
|
* @param {number} value - New value.
|
|
|
|
*/
|
2023-03-01 11:45:15 +00:00
|
|
|
'update:rows'(value: number): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when page changes, the event object contains information about the new state.
|
|
|
|
* @param {DataViewPageEvent} event - Custom page event.
|
|
|
|
*/
|
2023-03-01 11:45:15 +00:00
|
|
|
page(event: DataViewPageEvent): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 11:45:15 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - DataViewLayoutOptions**
|
|
|
|
*
|
|
|
|
* _DataView displays data in grid or list layout with pagination and sorting features._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/dataview/)
|
|
|
|
* --- ---
|
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
declare class DataView extends ClassComponent<DataViewProps, DataViewSlots, DataViewEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
DataView: GlobalComponentConstructor<DataView>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default DataView;
|