primevue-mirror/components/lib/dataview/DataView.d.ts

319 lines
8.0 KiB
TypeScript
Raw Normal View History

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';
import { PaginatorPassThroughOptionType } from '../paginator';
2022-09-06 12:03:37 +00:00
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type DataViewPassThroughOptionType = DataViewPassThroughAttributes | ((options: DataViewPassThroughMethodOptions) => DataViewPassThroughAttributes | string) | string | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface DataViewPassThroughMethodOptions {
2023-07-06 12:01:33 +00:00
instance: any;
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;
}
/**
* Custom passthrough(pt) options.
* @see {@link DataViewProps.pt}
*/
export interface DataViewPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: DataViewPassThroughOptionType;
/**
* Uses to pass attributes to the header's DOM element.
*/
header?: DataViewPassThroughOptionType;
/**
* Uses to pass attributes to the Paginator component.
* @see {@link PaginatorPassThroughOptionType}
*/
paginator?: PaginatorPassThroughOptionType;
/**
* Uses to pass attributes to the content's DOM element.
*/
content?: DataViewPassThroughOptionType;
2023-06-02 06:46:02 +00:00
/**
* Uses to pass attributes to the grid's DOM element.
*/
grid?: DataViewPassThroughOptionType;
/**
* Uses to pass attributes to the column's DOM element.
*/
column?: DataViewPassThroughOptionType;
/**
* Uses to pass attributes to the empty message's DOM element.
*/
emptyMessage?: DataViewPassThroughOptionType;
/**
* Uses to pass attributes to the footer's DOM element.
*/
footer?: DataViewPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
* Uses to manage all lifecycle hooks
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
}
/**
* 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;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {DataViewPassThroughOptions}
*/
pt?: 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;