primevue-mirror/components/lib/carousel/Carousel.d.ts

375 lines
9.3 KiB
TypeScript
Raw Normal View History

2023-03-01 14:46:28 +00:00
/**
*
* Carousel is a content slider featuring various customization options.
*
* [Live Demo](https://www.primevue.org/carousel/)
*
* @module carousel
*
*/
2022-12-08 11:04:25 +00:00
import { ButtonHTMLAttributes, VNode } from 'vue';
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
2023-09-05 08:50:46 +00:00
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PTOptions } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type CarouselPassThroughOptionType = CarouselPassThroughAttributes | ((options: CarouselPassThroughMethodOptions) => CarouselPassThroughAttributes | string) | string | null | undefined;
2023-05-04 07:46:18 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface CarouselPassThroughMethodOptions {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-05-04 07:46:18 +00:00
props: CarouselProps;
/**
* Defines current inline state.
*/
2023-05-04 07:46:18 +00:00
state: CarouselState;
/**
* Defines current options.
*/
2023-08-01 07:43:40 +00:00
context: CarouselContext;
2023-09-05 08:50:46 +00:00
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
2023-05-04 07:46:18 +00:00
}
/**
* Custom passthrough(pt) options.
* @see {@link CarouselProps.pt}
*/
export interface CarouselPassThroughOptions {
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
2023-05-04 07:46:18 +00:00
*/
root?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the header's DOM element.
2023-05-04 07:46:18 +00:00
*/
header?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the content's DOM element.
2023-05-04 07:46:18 +00:00
*/
content?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the container's DOM element.
2023-05-04 07:46:18 +00:00
*/
container?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the previous button's DOM element.
2023-05-04 07:46:18 +00:00
*/
previousButton?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the previous button icon's DOM element.
2023-05-04 07:46:18 +00:00
*/
previousButtonIcon?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the items content's DOM element.
2023-05-04 07:46:18 +00:00
*/
itemsContent?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the items container's DOM element.
2023-05-04 07:46:18 +00:00
*/
itemsContainer?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the item cloned's DOM element.
2023-05-04 07:46:18 +00:00
*/
itemCloned?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the item's DOM element.
2023-05-04 07:46:18 +00:00
*/
item?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the next button's DOM element.
2023-05-04 07:46:18 +00:00
*/
nextButton?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the next button icon's DOM element.
2023-05-04 07:46:18 +00:00
*/
nextButtonIcon?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the indicators's DOM element.
2023-05-04 07:46:18 +00:00
*/
indicators?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the indicator's DOM element.
2023-05-04 07:46:18 +00:00
*/
indicator?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the indicator button's DOM element.
2023-05-04 07:46:18 +00:00
*/
indicatorButton?: CarouselPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the footer's DOM element.
2023-05-04 07:46:18 +00:00
*/
footer?: CarouselPassThroughOptionType;
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-04 07:46:18 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface CarouselPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Carousel component.
*/
export interface CarouselState {
/**
* Remaining items' count as a number.
* @defaultValue 0
*/
remainingItems: number;
/**
* Number of items per page as a number.
* @defaultValue 1
*/
d_numVisible: number;
/**
* Number of items to scroll as a number.
* @defaultValue 1
*/
d_numScroll: number;
/**
* Old number of items to scroll as a number.
* @defaultValue 0
*/
d_oldNumScroll: number;
/**
* Old number of items per page as a number.
* @defaultValue 0
*/
d_oldNumVisible: number;
/**
* Old array of objects to display.
*/
d_oldValue: number;
/**
* Index of the first item.
* @defaultValue 0
*/
d_page: number;
/**
* Total shifted items' count as a number.
* @defaultValue 0
*/
totalShiftedItems: number;
/**
* Allow autoplay as a boolean.
* @defaultValue false
*/
allowAutoplay: boolean;
/**
* Defines if scrolling would be infinite as a boolean.
* @defaultValue false
*/
d_circular: boolean;
/**
* Swipe threshold count as a number.
* @defaultValue 20
*/
swipeThreshold: number;
}
2023-08-01 07:43:40 +00:00
/**
* Defines current inline options in Carousel component.
*/
2023-08-01 07:47:15 +00:00
export interface CarouselContext {
2023-08-01 07:43:40 +00:00
/**
* Current highlighted state of the indicator as a boolean.
* @defaultValue false
*/
highlighted: boolean;
}
2022-09-06 12:03:37 +00:00
export interface CarouselResponsiveOptions {
/**
* Breakpoint for responsive mode. Exp; @media screen and (max-width: ${breakpoint}) {...}
*/
breakpoint: string;
/**
* The number of visible items on breakpoint.
*/
numVisible: number;
/**
* The number of scrolled items on breakpoint.
*/
numScroll: number;
}
2023-05-04 07:46:18 +00:00
2023-03-01 14:46:28 +00:00
/**
* Defines valid properties in Carousel component.
*/
2022-09-06 12:03:37 +00:00
export interface CarouselProps {
/**
* An array of objects to display.
*/
value?: any | undefined;
/**
* Index of the first item.
2023-03-01 14:46:28 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
2022-09-14 11:26:01 +00:00
page?: number | undefined;
2022-09-06 12:03:37 +00:00
/**
* Number of items per page.
2023-03-01 14:46:28 +00:00
* @defaultValue 1
2022-09-06 12:03:37 +00:00
*/
2022-09-14 11:26:01 +00:00
numVisible?: number | undefined;
2022-09-06 12:03:37 +00:00
/**
* Number of items to scroll.
2023-03-01 14:46:28 +00:00
* @defaultValue 1
2022-09-06 12:03:37 +00:00
*/
2022-09-14 11:26:01 +00:00
numScroll?: number | undefined;
2022-09-06 12:03:37 +00:00
/**
* An array of options for responsive design.
* @see CarouselResponsiveOptions
*/
2022-09-14 11:26:01 +00:00
responsiveOptions?: CarouselResponsiveOptions[] | undefined;
2022-09-06 12:03:37 +00:00
/**
* Specifies the layout of the component, valid values are 'horizontal' and 'vertical'.
2023-03-01 14:46:28 +00:00
* @defaultValue horizontal
2022-09-06 12:03:37 +00:00
*/
2023-03-01 14:46:28 +00:00
orientation?: 'horizontal' | 'vertical' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Height of the viewport in vertical layout.
2023-03-08 10:51:52 +00:00
* @defaultValue 300px
2022-09-06 12:03:37 +00:00
*/
2022-09-14 11:26:01 +00:00
verticalViewPortHeight?: string | undefined;
2022-09-06 12:03:37 +00:00
/**
* Style class of the viewport container.
*/
2022-09-14 11:26:01 +00:00
containerClass?: any;
2022-09-06 12:03:37 +00:00
/**
* Style class of main content.
*/
2022-09-14 11:26:01 +00:00
contentClass?: any;
2022-09-06 12:03:37 +00:00
/**
* Style class of the indicator items.
*/
2022-09-14 11:26:01 +00:00
indicatorsContentClass?: any;
2022-09-06 12:03:37 +00:00
/**
* Defines if scrolling would be infinite.
2023-03-01 14:46:28 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
2022-09-14 11:26:01 +00:00
circular?: boolean | undefined;
2022-09-06 12:03:37 +00:00
/**
* Time in milliseconds to scroll items automatically.
2023-03-01 14:46:28 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
2022-09-14 11:26:01 +00:00
autoplayInterval?: number | undefined;
/**
* Whether to display navigation buttons in container.
2023-03-01 14:46:28 +00:00
* @defaultValue true
2022-09-14 11:26:01 +00:00
*/
showNavigators?: boolean | undefined;
/**
* Whether to display indicator container.
2023-03-01 14:46:28 +00:00
* @defaultValue true
2022-09-14 11:26:01 +00:00
*/
showIndicators?: boolean | undefined;
2022-12-08 11:04:25 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass all properties of the HTMLButtonElement to the previous navigation button.
2022-12-08 11:04:25 +00:00
*/
prevButtonProps?: ButtonHTMLAttributes | undefined;
/**
2023-08-01 14:01:12 +00:00
* Used to pass all properties of the HTMLButtonElement to the next navigation button.
2022-12-08 11:04:25 +00:00
*/
nextButtonProps?: ButtonHTMLAttributes | undefined;
2023-05-04 07:46:18 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-05-04 07:46:18 +00:00
* @type {CarouselPassThroughOptions}
*/
pt?: PTOptions<CarouselPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
2023-05-31 13:57:44 +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 14:46:28 +00:00
/**
* Defines valid slots in Carousel slots.
*/
2022-09-06 12:03:37 +00:00
export interface CarouselSlots {
/**
* Custom content for each item.
* @param {Object} scope - item slot's params.
*/
2023-03-01 14:46:28 +00:00
item(scope: {
2022-09-06 12:03:37 +00:00
/**
* Data of the component
*/
data: any;
/**
* Index of the item
*/
index: number;
2023-03-01 14:46:28 +00:00
}): VNode[];
2022-09-14 11:26:01 +00:00
/**
2022-09-06 12:03:37 +00:00
* Custom header template.
*/
2023-03-01 14:46:28 +00:00
header(): VNode[];
2022-09-14 11:26:01 +00:00
/**
* Custom footer template.
*/
2023-03-01 14:46:28 +00:00
footer(): VNode[];
/**
* Custom previous icon template.
*/
previousicon(): VNode[];
/**
* Custom next icon template.
*/
nexticon(): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 14:46:28 +00:00
/**
* Defines valid emits in Carousel component.
*/
export interface CarouselEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the page changes.
* @param {number} value - New page value.
*/
2023-03-01 14:46:28 +00:00
'update:page'(value: number): void;
}
2022-09-06 12:03:37 +00:00
2023-03-01 14:46:28 +00:00
/**
* **PrimeVue - Carousel**
*
* _Carousel is a content slider featuring various customization options._
*
* [Live Demo](https://www.primevue.org/carousel/)
* --- ---
2023-03-03 10:55:20 +00:00
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
2023-03-01 14:46:28 +00:00
*
* @group Component
*
*/
2022-09-14 11:26:01 +00:00
declare class Carousel extends ClassComponent<CarouselProps, CarouselSlots, CarouselEmits> {}
2022-09-06 12:03:37 +00:00
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Carousel: GlobalComponentConstructor<Carousel>;
2022-09-06 12:03:37 +00:00
}
}
export default Carousel;