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';
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2023-05-09 22:39:10 +00:00
|
|
|
import { PaginatorPassThroughOptionType } from '../paginator';
|
2023-08-17 23:51:01 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor, PTOptions } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-07-11 22:42:43 +00:00
|
|
|
export declare type DataViewPassThroughOptionType = DataViewPassThroughAttributes | ((options: DataViewPassThroughMethodOptions) => DataViewPassThroughAttributes | string) | string | null | undefined;
|
2023-05-09 22:39:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface DataViewPassThroughMethodOptions {
|
2023-07-06 12:01:33 +00:00
|
|
|
instance: any;
|
2023-05-09 22:39:10 +00:00
|
|
|
props: DataViewProps;
|
|
|
|
state: DataViewState;
|
|
|
|
}
|
2023-03-01 11:45:15 +00:00
|
|
|
/**
|
2023-03-06 20:35:39 +00:00
|
|
|
* Custom page event.
|
|
|
|
* @see {@link DataViewEmits.page}
|
2023-03-01 11:45:15 +00:00
|
|
|
*/
|
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-05-09 22:39:10 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link DataViewProps.pt}
|
|
|
|
*/
|
|
|
|
export interface DataViewPassThroughOptions {
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-05-09 22:39:10 +00:00
|
|
|
*/
|
|
|
|
root?: DataViewPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the header's DOM element.
|
2023-05-09 22:39:10 +00:00
|
|
|
*/
|
|
|
|
header?: DataViewPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the Paginator component.
|
2023-05-09 22:39:10 +00:00
|
|
|
* @see {@link PaginatorPassThroughOptionType}
|
|
|
|
*/
|
|
|
|
paginator?: PaginatorPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the content's DOM element.
|
2023-05-09 22:39:10 +00:00
|
|
|
*/
|
|
|
|
content?: DataViewPassThroughOptionType;
|
2023-06-02 06:46:02 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the grid's DOM element.
|
2023-06-02 06:46:02 +00:00
|
|
|
*/
|
|
|
|
grid?: DataViewPassThroughOptionType;
|
2023-05-09 22:39:10 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the column's DOM element.
|
2023-05-09 22:39:10 +00:00
|
|
|
*/
|
|
|
|
column?: DataViewPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the empty message's DOM element.
|
2023-05-09 22:39:10 +00:00
|
|
|
*/
|
|
|
|
emptyMessage?: DataViewPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the footer's DOM element.
|
2023-05-09 22:39:10 +00:00
|
|
|
*/
|
|
|
|
footer?: DataViewPassThroughOptionType;
|
2023-07-06 11:09:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to manage all lifecycle hooks
|
2023-07-06 11:09:01 +00:00
|
|
|
* @see {@link BaseComponent.ComponentHooks}
|
|
|
|
*/
|
|
|
|
hooks?: ComponentHooks;
|
2023-05-09 22:39:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface DataViewPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in DataView component.
|
|
|
|
*/
|
|
|
|
export interface DataViewState {
|
|
|
|
/**
|
|
|
|
* Current index of first record as a number.
|
|
|
|
*/
|
|
|
|
d_first: number;
|
|
|
|
/**
|
|
|
|
* Current number of rows to display in new page as a number.
|
|
|
|
*/
|
|
|
|
d_rows: 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-08 10:51:52 +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-08 10:51:52 +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-08 11:02:08 +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-05-09 22:39:10 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-05-09 22:39:10 +00:00
|
|
|
* @type {DataViewPassThroughOptions}
|
|
|
|
*/
|
2023-08-17 23:51:01 +00:00
|
|
|
pt?: PTOptions<DataViewPassThroughOptions>;
|
2023-06-01 12:02:56 +00:00
|
|
|
/**
|
|
|
|
* When enabled, it removes component related styles in the core.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
unstyled?: boolean;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
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;
|