primevue-mirror/components/lib/paginator/Paginator.d.ts

458 lines
12 KiB
TypeScript
Raw Normal View History

2023-03-01 11:45:54 +00:00
/**
*
* Paginator is a generic component to display content in paged format.
*
2023-04-05 14:01:38 +00:00
* [Live Demo](https://primevue.org/paginator)
2023-03-01 11:45:54 +00:00
*
* @module paginator
*
*/
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 { DropdownPassThroughOptions } from '../dropdown';
import { InputNumberPassThroughOptions } from '../inputnumber';
2023-09-05 08:50:46 +00:00
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, DesignToken, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type PaginatorPassThroughOptionType<T = any> = PaginatorPassThroughAttributes | ((options: PaginatorPassThroughMethodOptions<T>) => PaginatorPassThroughAttributes | string) | string | null | undefined;
2023-05-08 09:35:25 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface PaginatorPassThroughMethodOptions<T> {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-05-08 09:35:25 +00:00
props: PaginatorProps;
/**
* Defines current inline state.
*/
2023-05-08 09:35:25 +00:00
state: PaginatorState;
/**
* Defines parent instance.
*/
parent: T;
/**
* Defines current options.
*/
2023-05-08 09:35:25 +00:00
context: PaginatorContext;
2023-09-05 08:50:46 +00:00
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
2023-05-08 09:35:25 +00:00
}
/**
* Custom shared passthrough(pt) option method.
*/
export interface PaginatorSharedPassThroughMethodOptions {
/**
* Defines valid properties.
*/
props: PaginatorProps;
/**
* Defines current inline state.
*/
state: PaginatorState;
}
2023-05-08 09:35:25 +00:00
/**
* Custom passthrough(pt) options.
* @see {@link PaginatorProps.pt}
*/
export interface PaginatorPassThroughOptions<T = any> {
2023-06-05 11:04:02 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the paginator wrapper's DOM element.
2023-06-05 11:04:02 +00:00
*/
paginatorWrapper?: PaginatorPassThroughOptionType<T> | any;
2023-05-08 09:35:25 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
2023-05-08 09:35:25 +00:00
*/
root?: PaginatorPassThroughOptionType<T>;
2023-05-08 09:35:25 +00:00
/**
* Used to pass attributes to the content start's DOM element.
2023-05-08 09:35:25 +00:00
*/
contentStart?: PaginatorPassThroughOptionType<T>;
2023-05-08 09:35:25 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the first page button's DOM element.
2023-05-08 09:35:25 +00:00
*/
first?: PaginatorPassThroughOptionType<T>;
2023-05-08 09:35:25 +00:00
/**
* Used to pass attributes to the first icon's DOM element.
2023-05-08 09:35:25 +00:00
*/
firstIcon?: PaginatorPassThroughOptionType<T>;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the prev page button's DOM element.
*/
prev?: PaginatorPassThroughOptionType<T>;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the prev page icon's DOM element.
*/
prevIcon?: PaginatorPassThroughOptionType<T>;
2023-05-08 09:35:25 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the next page button's DOM element.
2023-05-08 09:35:25 +00:00
*/
next?: PaginatorPassThroughOptionType<T>;
2023-05-08 09:35:25 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the next page icon's DOM element.
2023-05-08 09:35:25 +00:00
*/
nextIcon?: PaginatorPassThroughOptionType<T>;
2023-05-08 09:35:25 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the last page button's DOM element.
2023-05-08 09:35:25 +00:00
*/
last?: PaginatorPassThroughOptionType<T>;
2023-05-08 09:35:25 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the last page icon's DOM element.
2023-05-08 09:35:25 +00:00
*/
lastIcon?: PaginatorPassThroughOptionType<T>;
2023-05-08 09:35:25 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the pages's DOM element.
2023-05-08 09:35:25 +00:00
*/
pages?: PaginatorPassThroughOptionType<T>;
2023-05-08 09:35:25 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the page button's DOM element.
2023-05-08 09:35:25 +00:00
*/
page?: PaginatorPassThroughOptionType<T>;
2023-05-08 09:35:25 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the current's DOM element.
2023-05-08 09:35:25 +00:00
*/
current?: PaginatorPassThroughOptionType<T>;
2023-05-08 09:35:25 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Dropdown component.
* @see {@link DropdownPassThroughOptions}
2023-05-08 09:35:25 +00:00
*/
2024-05-06 15:23:01 +00:00
pcRowPerPageDropdown?: DropdownPassThroughOptions<PaginatorSharedPassThroughMethodOptions>;
2023-05-08 09:35:25 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Dropdown component.
* @see {@link DropdownPassThroughOptions}
*/
2024-05-06 15:23:01 +00:00
pcJumpToPageDropdown?: DropdownPassThroughOptions<PaginatorSharedPassThroughMethodOptions>;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Dropdown component.
* @see {@link InputNumberPassThroughOptions}
*/
2024-05-06 15:23:01 +00:00
pcJumpToPageInput?: InputNumberPassThroughOptions<PaginatorSharedPassThroughMethodOptions>;
2023-05-08 09:35:25 +00:00
/**
* Used to pass attributes to the content end's DOM element.
2023-05-08 09:35:25 +00:00
*/
contentEnd?: PaginatorPassThroughOptionType<T>;
2023-07-06 11:09:01 +00:00
/**
2023-11-07 06:16:39 +00:00
* Used to manage all lifecycle hooks.
2023-07-06 11:09:01 +00:00
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
2023-05-08 09:35:25 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface PaginatorPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Paginator component.
*/
export interface PaginatorState {
/**
* 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;
}
/**
* Defines current options in Paginator component.
*/
export interface PaginatorContext {
/**
* Current active state as a boolean.
* @defaultValue false
*/
active: boolean;
/**
* Current disabled state of the button as a boolean.
* @defaultValue false
*/
disabled: boolean;
}
2023-03-01 11:45:54 +00:00
/**
* Paginator page state metadata.
*/
2022-09-06 12:03:37 +00:00
export interface PageState {
/**
* Index of first record
*/
first: number;
/**
* Number of rows to display in new page
*/
rows: number;
/**
* New page number
*/
page: number;
/**
* Total number of pages
*/
pageCount?: number;
}
2023-03-01 11:45:54 +00:00
/**
* Defines valid properties in Paginator component.
*/
2022-09-06 12:03:37 +00:00
export interface PaginatorProps {
/**
* Number of total records.
2023-03-01 11:45:54 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
totalRecords?: number | undefined;
/**
* Data count to display per page.
2023-03-01 11:45:54 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
rows?: number | undefined;
/**
* Zero-relative number of the first row to be displayed.
2023-03-01 11:45:54 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
first?: number | undefined;
/**
* Number of page links to display.
2023-03-01 11:45:54 +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-06-14 14:28:21 +00:00
* Template of the paginator, can either be a string or an object with key-value pairs to define templates per breakpoint. Available templates are the following;
2022-09-06 12:03:37 +00:00
*
* - FirstPageLink
* - PrevPageLink
* - PageLinks
* - NextPageLink
* - LastPageLink
* - RowsPerPageDropdown
* - JumpToPageDropdown
* - JumpToPageInput
* - CurrentPageReport
*/
2022-12-08 11:04:25 +00:00
template?: any | string;
2022-09-06 12:03:37 +00:00
/**
2023-03-01 11:45:54 +00:00
* Template of the current page report element. It displays information about the pagination state. Available placeholders are the following;
2022-09-06 12:03:37 +00:00
*
* - {currentPage}
* - {totalPages}
* - {rows}
* - {first}
* - {last}
* - {totalRecords}
2023-03-01 11:45:54 +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;
/**
* Whether to show the paginator even there is only one page.
2023-03-01 11:45:54 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
alwaysShow?: boolean | undefined;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
2023-05-08 09:35:25 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-05-08 09:35:25 +00:00
* @type {PaginatorPassThroughOptions}
*/
pt?: PassThrough<PaginatorPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
2022-09-06 12:03:37 +00:00
}
2023-03-01 11:45:54 +00:00
/**
* Defines valid slots in Paginator component.
*/
2022-09-06 12:03:37 +00:00
export interface PaginatorSlots {
/**
* Custom start template.
* @param {Object} scope - start slot's params.
*/
2023-03-01 11:45:54 +00:00
start(scope: {
2022-09-06 12:03:37 +00:00
/**
* Current state
* @see PageState
*/
state: PageState;
2023-03-01 11:45:54 +00:00
}): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom end template.
* @param {Object} scope - end slot's params.
*/
2023-03-01 11:45:54 +00:00
end(scope: {
2022-09-06 12:03:37 +00:00
/**
* Current state
* @see PageState
*/
state: PageState;
2023-03-01 11:45:54 +00:00
}): VNode[];
/**
2024-05-06 11:07:53 +00:00
* @deprecated since v4.0. Use 'firsticon' slot instead.
* Custom first page link icon template.
2024-05-06 11:07:53 +00:00
* @param {Object} scope - firstpagelinkicon's params.
*/
2024-05-06 11:07:53 +00:00
firstpagelinkicon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* Custom first page link icon template.
* @param {Object} scope - firsticon's params.
*/
firsticon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
2024-05-06 11:07:53 +00:00
* @deprecated since v4.0. Use 'previcon' slot instead.
* Custom previous page link icon template.
2024-05-06 11:07:53 +00:00
* @param {Object} scope - prevpagelinkicon's params.
*/
prevpagelinkicon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* Custom previous page link icon template.
* @param {Object} scope - previcon's params.
*/
previcon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* @deprecated since v4.0. Use 'nexticon' slot instead.
* Custom finextrst page link icon template.
* @param {Object} scope - nextpagelinkicon's params.
*/
2024-05-06 11:07:53 +00:00
nextpagelinkicon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* Custom finextrst page link icon template.
2024-05-06 11:07:53 +00:00
* @param {Object} scope - nexticon's params.
*/
nexticon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* @deprecated since v4.0. Use 'lasticon' slot instead.
* Custom last page link icon template.
* @param {Object} scope - lastpagelinkicon's params.
*/
2024-05-06 11:07:53 +00:00
lastpagelinkicon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* Custom last page link icon template.
2024-05-06 11:07:53 +00:00
* @param {Object} scope - lasticon's params.
*/
2024-05-06 11:07:53 +00:00
lasticon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* Custom rowsperpagedropdownicon template.
* @param {Object} scope - rowsperpagedropdownicon's params.
*/
rowsperpagedropdownicon(scope: {
/**
* Style class of the rowsperpagedropdown icon.
*/
class: string;
}): VNode[];
/**
* Custom jumptopagedropdownicon template.
* @param {Object} scope - jumptopagedropdownicon's params.
*/
jumptopagedropdownicon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 11:45:54 +00:00
/**
* Defines valid emits in Paginator component.
*/
export interface PaginatorEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the first changes.
* @param {number} value - New value.
*/
2023-03-01 11:45:54 +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 11:45:54 +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 {PageState} event - New page state.
*/
2023-03-01 11:45:54 +00:00
page(event: PageState): void;
}
2022-09-06 12:03:37 +00:00
2023-03-01 11:45:54 +00:00
/**
* **PrimeVue - Paginator**
*
* _Paginator is a generic widget to display content in paged format._
*
* [Live Demo](https://www.primevue.org/paginator/)
* --- ---
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
*
* @group Component
*/
2022-09-14 11:26:01 +00:00
declare class Paginator extends ClassComponent<PaginatorProps, PaginatorSlots, PaginatorEmits> {}
2022-09-06 12:03:37 +00:00
declare module 'vue' {
export interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Paginator: GlobalComponentConstructor<Paginator>;
2022-09-06 12:03:37 +00:00
}
}
export default Paginator;