primevue
Version:
PrimeVue is a premium UI library for Vue featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock, wh
307 lines (289 loc) • 8.79 kB
TypeScript
/**
*
* Gallery is a compound, headless image gallery with zoom, rotate, flip, fullscreen, download and a thumbnail strip.
* Compose the parts (`GalleryContent`, `GalleryItem`, `GalleryThumbnail`, navigation buttons, toolbar actions, etc.)
* to build the desired layout. The root carries `data-fullscreen`, `data-zoomed`, `data-rotated` and `data-flipped`
* attributes that mirror the active item's state — useful as CSS hooks for layout adjustments.
*
* [Live Demo](https://www.primevue.dev/gallery/)
*
* @module gallery
*
*/
import type { DefineComponent, DesignToken, EmitFn, PassThrough } from '@primevue/core';
import type { ComponentHooks } from '@primevue/core/basecomponent';
import type { PassThroughOptions } from 'primevue/passthrough';
import type { Component, HTMLAttributes, VNode } from 'vue';
export declare type GalleryPassThroughOptionType = GalleryPassThroughAttributes | ((options: GalleryPassThroughMethodOptions) => GalleryPassThroughAttributes | string) | string | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface GalleryPassThroughMethodOptions {
/**
* Defines instance.
*/
instance: any;
/**
* Defines valid properties.
*/
props: GalleryProps;
/**
* Defines current inline state.
*/
state: GalleryState;
/**
* Defines current options.
*/
context: GalleryContext;
/**
* Defines valid attributes.
*/
attrs: any;
/**
* Defines parent options.
*/
parent: any;
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
}
/**
* Custom passthrough(pt) options.
* @see {@link GalleryProps.pt}
*/
export interface GalleryPassThroughOptions {
/**
* Used to pass attributes to the root's DOM element.
*/
root?: GalleryPassThroughOptionType;
/**
* Used to manage all lifecycle hooks.
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
}
/**
* Custom passthrough attributes for each DOM elements.
*/
export interface GalleryPassThroughAttributes {
[key: string]: any;
}
/**
* Pending action dispatched from a toolbar button to be executed by the active item.
*/
export interface GalleryPendingAction {
/**
* Action type.
*/
type: 'zoom-in' | 'zoom-out' | 'rotate-left' | 'rotate-right' | 'flip-x' | 'flip-y' | 'download';
/**
* Timestamp used to differentiate consecutive actions of the same type.
*/
timestamp: number;
}
/**
* Aggregated transform state of the active item, reported back from `GalleryItem` to the root.
*/
export interface GalleryActiveItemTransform {
/**
* Whether the active item is zoomed (`scale > normalScale`).
*/
zoomed: boolean;
/**
* Whether the active item is rotated (`rotation !== 0`).
*/
rotated: boolean;
/**
* Whether the active item is flipped on either axis.
*/
flipped: boolean;
}
/**
* Defines current inline state in Gallery component.
*/
export interface GalleryState {
/**
* Current active item index, mirrored from the `activeIndex` prop and `v-model:activeIndex`.
*/
d_activeIndex: number;
/**
* Whether the gallery is in fullscreen mode.
*/
isFullscreen: boolean;
/**
* Pending action dispatched from a toolbar button.
*/
pendingAction: GalleryPendingAction | null;
/**
* Aggregated transform state of the active item.
*/
activeItemTransform: GalleryActiveItemTransform;
}
/**
* Defines current options in Gallery component.
*/
export interface GalleryContext {
[key: string]: any;
}
/**
* Defines valid properties in Gallery component.
*/
export interface GalleryProps {
/**
* Index of the active item. Pair with `v-model:activeIndex` for two-way binding.
* @defaultValue 0
*/
activeIndex?: number;
/**
* Use to change the HTML tag of root element.
* @defaultValue DIV
*/
as?: string | Component | undefined;
/**
* When enabled, it changes the default rendered element for the one passed as a child element.
* @defaultValue false
*/
asChild?: boolean | undefined;
/**
* When enabled, the gallery is displayed in fullscreen mode. Pair with `v-model:fullscreen` for two-way binding.
* @defaultValue false
*/
fullscreen?: boolean;
/**
* Whether pressing the Escape key exits fullscreen mode.
* @defaultValue true
*/
closeOnEscape?: boolean;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
/**
* Used to pass attributes to DOM elements inside the component.
* @type {GalleryPassThroughOptions}
*/
pt?: PassThrough<GalleryPassThroughOptions>;
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
/**
* When enabled, it removes component related styles in the core.
* @defaultValue false
*/
unstyled?: boolean;
}
/**
* Root element attributes forwarded to the consumer when `asChild` is enabled.
*/
export interface GalleryA11yAttrs extends HTMLAttributes {
/**
* Function ref used by Gallery to access the consumer's rendered root element
* for fullscreen style management.
*/
ref: (el: Element | null) => void;
/**
* PrimeVue component identifier.
*/
'data-pc-name': 'gallery';
/**
* Present while Gallery is in fullscreen mode.
*/
'data-fullscreen'?: '' | undefined;
/**
* Present while the active item is zoomed (`scale > normalScale`).
*/
'data-zoomed'?: '' | undefined;
/**
* Present while the active item is rotated (`rotation !== 0`).
*/
'data-rotated'?: '' | undefined;
/**
* Present while the active item is flipped on either axis.
*/
'data-flipped'?: '' | undefined;
}
/**
* Defines valid slots in Gallery component.
*/
export interface GallerySlots {
/**
* Default slot, place `GalleryContent`, `GalleryHeader`, `GalleryFooter` etc. inside.
* Receives scope props when `asChild` is enabled.
* @param {Object} scope - default slot's params.
*/
default(scope: {
/**
* Computed class name for the root.
*/
class: string | object | Array<string | object>;
/**
* Attributes to spread on the consumer's root element so the gallery state can be tracked
* via `data-*` attributes (fullscreen, zoomed, rotated, flipped).
*/
a11yAttrs: GalleryA11yAttrs;
}): VNode[];
}
/**
* Defines valid emits in Gallery component.
*/
export interface GalleryEmitsOptions {
/**
* Emitted when the active item index changes (e.g. via navigation buttons or thumbnail click).
* @param {number} value - New active index.
*/
'update:activeIndex'(value: number): void;
/**
* Emitted when the fullscreen state changes, via the `GalleryFullScreen` button or the `fullscreen` prop.
* @param {boolean} value - New fullscreen state.
*/
'update:fullscreen'(value: boolean): void;
/**
* Emitted when the active item's zoom scale changes.
* @param {number} scale - Current zoom scale.
*/
'zoom-change'(scale: number): void;
/**
* Emitted when the active item's rotation changes.
* @param {number} rotation - Current rotation in degrees.
*/
'rotate-change'(rotation: number): void;
/**
* Emitted when the active item's flip state changes.
* @param {{ x: number; y: number }} flip - Current flip state on each axis.
*/
'flip-change'(flip: { x: number; y: number }): void;
}
export declare type GalleryEmits = EmitFn<GalleryEmitsOptions>;
/**
* Defines valid public methods exposed by the Gallery component instance.
*/
export interface GalleryMethods {
/**
* Returns the number of items currently registered to the Gallery by its children.
*
* @memberof Gallery
*/
getItemCount(): number;
}
/**
* **PrimeVue - Gallery**
*
* _Gallery is a compound, headless image gallery with zoom, rotate, flip, fullscreen, download and a thumbnail strip._
*
* [Live Demo](https://www.primevue.dev/gallery/)
* --- ---
* 
*
* @group Component
*
*/
declare const Gallery: DefineComponent<GalleryProps, GallerySlots, GalleryEmits, GalleryMethods>;
declare module 'vue' {
export interface GlobalComponents {
Gallery: DefineComponent<GalleryProps, GallerySlots, GalleryEmits, GalleryMethods>;
}
}
export default Gallery;