2023-03-01 15:05:23 +00:00
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* Displays an image with preview and tranformation options. For multiple image, see Galleria.
|
|
|
|
|
*
|
|
|
|
|
* [Live Demo](https://www.primevue.org/image/)
|
|
|
|
|
*
|
|
|
|
|
* @module image
|
|
|
|
|
*
|
|
|
|
|
*/
|
2023-08-02 14:07:22 +00:00
|
|
|
|
import { TransitionProps, 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';
|
2024-05-16 10:50:43 +00:00
|
|
|
|
import { DefineComponent, DesignToken, EmitFn, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
2023-08-02 14:07:22 +00:00
|
|
|
|
|
2023-07-11 22:42:43 +00:00
|
|
|
|
export declare type ImagePassThroughOptionType = ImagePassThroughAttributes | ((options: ImagePassThroughMethodOptions) => ImagePassThroughAttributes | string) | string | null | undefined;
|
2023-05-04 07:45:01 +00:00
|
|
|
|
|
2023-08-02 14:07:22 +00:00
|
|
|
|
export declare type ImagePassThroughTransitionType = TransitionProps | ((options: ImagePassThroughMethodOptions) => TransitionProps) | undefined;
|
|
|
|
|
|
2023-05-04 07:45:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
|
*/
|
|
|
|
|
export interface ImagePassThroughMethodOptions {
|
2023-09-05 06:50:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* Defines instance.
|
|
|
|
|
*/
|
2023-07-06 12:01:33 +00:00
|
|
|
|
instance: any;
|
2023-09-05 06:50:04 +00:00
|
|
|
|
/**ˆ
|
|
|
|
|
* Defines valid properties.
|
|
|
|
|
*/
|
2023-05-04 07:45:01 +00:00
|
|
|
|
props: ImageProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* Defines current inline state.
|
|
|
|
|
*/
|
2023-05-04 07:45:01 +00:00
|
|
|
|
state: ImageState;
|
2023-12-10 21:41:17 +00:00
|
|
|
|
/**
|
|
|
|
|
* Defines valid attributes.
|
|
|
|
|
*/
|
|
|
|
|
attrs: any;
|
2023-12-05 11:06:32 +00:00
|
|
|
|
/**
|
|
|
|
|
* Defines parent options.
|
|
|
|
|
*/
|
|
|
|
|
parent: any;
|
2023-09-05 08:50:46 +00:00
|
|
|
|
/**
|
|
|
|
|
* Defines passthrough(pt) options in global config.
|
|
|
|
|
*/
|
|
|
|
|
global: object | undefined;
|
2023-05-04 07:45:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
|
* @see {@link ImageProps.pt}
|
|
|
|
|
*/
|
|
|
|
|
export interface ImagePassThroughOptions {
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
root?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the image's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
image?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the preview mask's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
2024-04-30 09:39:18 +00:00
|
|
|
|
previewMask?: ImagePassThroughOptionType;
|
2023-05-04 07:45:01 +00:00
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the preview icon's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
2024-04-30 09:39:18 +00:00
|
|
|
|
previewIcon?: ImagePassThroughOptionType;
|
2023-05-04 07:45:01 +00:00
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the mask's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
mask?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the toolbar's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
toolbar?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the rotate right button's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
rotateRightButton?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the rotate right icon's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
rotateRightIcon?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the rotate left button's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
rotateLeftButton?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the rotate left icon's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
rotateLeftIcon?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the zoom out button's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
zoomOutButton?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the zoom out icon's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
zoomOutIcon?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the zoom in button's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
zoomInButton?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the zoom in icon's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
zoomInIcon?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the close button's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
closeButton?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the close icon's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
|
|
|
|
closeIcon?: ImagePassThroughOptionType;
|
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the original container's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
2024-04-30 09:39:18 +00:00
|
|
|
|
originalContainer?: ImagePassThroughOptionType;
|
2023-05-04 07:45:01 +00:00
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
|
* Used to pass attributes to the original's DOM element.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
*/
|
2024-04-30 09:39:18 +00:00
|
|
|
|
original?: ImagePassThroughOptionType;
|
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-08-02 12:01:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* Used to control Vue Transition API.
|
|
|
|
|
*/
|
2023-08-02 14:07:22 +00:00
|
|
|
|
transition?: ImagePassThroughTransitionType;
|
2023-05-04 07:45:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
|
*/
|
|
|
|
|
export interface ImagePassThroughAttributes {
|
|
|
|
|
[key: string]: any;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Defines current inline state in Image component.
|
|
|
|
|
*/
|
|
|
|
|
export interface ImageState {
|
|
|
|
|
/**
|
|
|
|
|
* Mask visible state as a boolean.
|
|
|
|
|
* @defaultValue false
|
|
|
|
|
*/
|
|
|
|
|
maskVisible: boolean;
|
|
|
|
|
/**
|
|
|
|
|
* Preview visible state as a boolean.
|
|
|
|
|
* @defaultValue false
|
|
|
|
|
*/
|
|
|
|
|
previewVisible: boolean;
|
|
|
|
|
/**
|
|
|
|
|
* Rotate state as a number.
|
|
|
|
|
* @defaultValue 0
|
|
|
|
|
*/
|
|
|
|
|
rotate: number;
|
|
|
|
|
/**
|
|
|
|
|
* Scale state as a boolean.
|
|
|
|
|
* @defaultValue 1
|
|
|
|
|
*/
|
|
|
|
|
scale: number;
|
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
2023-03-01 15:05:23 +00:00
|
|
|
|
/**
|
|
|
|
|
* Defines valid properties in Image component.
|
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
|
export interface ImageProps {
|
|
|
|
|
/**
|
|
|
|
|
* Controls the preview functionality.
|
2023-03-01 15:05:23 +00:00
|
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
|
*/
|
|
|
|
|
preview?: boolean | undefined;
|
|
|
|
|
/**
|
|
|
|
|
* Inline style of the image element.
|
|
|
|
|
*/
|
|
|
|
|
imageStyle?: any;
|
|
|
|
|
/**
|
|
|
|
|
* Style class of the image element.
|
|
|
|
|
*/
|
|
|
|
|
imageClass?: any;
|
2023-03-21 13:59:02 +00:00
|
|
|
|
/**
|
|
|
|
|
* Custom indicator icon.
|
2024-05-06 10:45:36 +00:00
|
|
|
|
* @deprecated since v4.0. Use 'previewIcon' prop instead.
|
2023-03-21 13:59:02 +00:00
|
|
|
|
*/
|
2024-05-06 10:45:36 +00:00
|
|
|
|
indicatorIcon?: string | undefined;
|
|
|
|
|
/**
|
|
|
|
|
* Custom indicator icon.
|
|
|
|
|
*/
|
|
|
|
|
previewIcon?: string | undefined;
|
2023-04-10 10:35:15 +00:00
|
|
|
|
/**
|
|
|
|
|
* Disable the zoom-in button
|
|
|
|
|
* @defaultValue false
|
|
|
|
|
*/
|
|
|
|
|
zoomInDisabled?: boolean | undefined;
|
|
|
|
|
/**
|
|
|
|
|
* Disable the zoom-out button
|
|
|
|
|
* @defaultValue false
|
|
|
|
|
*/
|
|
|
|
|
zoomOutDisabled?: boolean | undefined;
|
2024-04-02 08:24:31 +00:00
|
|
|
|
/**
|
|
|
|
|
* It generates scoped CSS variables using design tokens for the component.
|
|
|
|
|
*/
|
|
|
|
|
dt?: DesignToken<any>;
|
2023-05-04 07:45:01 +00:00
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-05-04 07:45:01 +00:00
|
|
|
|
* @type {ImagePassThroughOptions}
|
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
|
pt?: PassThrough<ImagePassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
|
/**
|
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
|
*/
|
|
|
|
|
ptOptions?: PassThroughOptions;
|
2023-05-31 08:00:55 +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 15:05:23 +00:00
|
|
|
|
/**
|
|
|
|
|
* Defines valid slots in Image slots.
|
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
|
export interface ImageSlots {
|
|
|
|
|
/**
|
|
|
|
|
* Custom indicator template.
|
|
|
|
|
*/
|
2024-05-06 10:45:36 +00:00
|
|
|
|
previewicon(): VNode[];
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated since v4.0. Use 'previewicon' slot instead.
|
|
|
|
|
* Custom indicator template.
|
|
|
|
|
*/
|
2024-03-07 19:02:39 +00:00
|
|
|
|
indicatoricon(): VNode[];
|
2023-03-22 13:40:31 +00:00
|
|
|
|
/**
|
|
|
|
|
* Custom refresh template.
|
|
|
|
|
*/
|
|
|
|
|
refresh(): VNode[];
|
|
|
|
|
/**
|
|
|
|
|
* Custom undo template.
|
|
|
|
|
*/
|
|
|
|
|
undo(): VNode[];
|
|
|
|
|
/**
|
|
|
|
|
* Custom zoomout template.
|
|
|
|
|
*/
|
|
|
|
|
zoomout(): VNode[];
|
|
|
|
|
/**
|
|
|
|
|
* Custom zoomin template.
|
|
|
|
|
*/
|
|
|
|
|
zoomin(): VNode[];
|
|
|
|
|
/**
|
|
|
|
|
* Custom close template.
|
|
|
|
|
*/
|
|
|
|
|
close(): VNode[];
|
2023-05-03 17:54:50 +00:00
|
|
|
|
/**
|
|
|
|
|
* Custom image template.
|
2023-08-17 07:16:25 +00:00
|
|
|
|
* @param {Object} scope - image slot's params.
|
2023-05-03 17:54:50 +00:00
|
|
|
|
*/
|
|
|
|
|
image(scope: {
|
|
|
|
|
/**
|
|
|
|
|
* Style class of the image element.
|
|
|
|
|
*/
|
|
|
|
|
class: any;
|
|
|
|
|
/**
|
|
|
|
|
* Style of the image element.
|
|
|
|
|
*/
|
|
|
|
|
style: any;
|
|
|
|
|
/**
|
|
|
|
|
* Image error function.
|
2023-10-31 17:21:47 +00:00
|
|
|
|
* @deprecated since v3.39.0. Use 'errorCallback' property instead.
|
2023-05-03 17:54:50 +00:00
|
|
|
|
*/
|
2023-08-17 07:16:25 +00:00
|
|
|
|
onError: () => void;
|
2023-10-31 17:21:47 +00:00
|
|
|
|
/**
|
|
|
|
|
* Preview click function.
|
|
|
|
|
*/
|
|
|
|
|
errorCallback: () => void;
|
2023-05-03 17:54:50 +00:00
|
|
|
|
}): VNode[];
|
|
|
|
|
/**
|
2024-05-06 10:45:36 +00:00
|
|
|
|
* @deprecated since v4.0. use 'original' slot instead.
|
2023-04-29 18:43:56 +00:00
|
|
|
|
* Custom preview template.
|
2023-08-17 07:16:25 +00:00
|
|
|
|
* @param {Object} scope - preview slot's params.
|
2023-04-29 18:43:56 +00:00
|
|
|
|
*/
|
2023-05-03 17:54:50 +00:00
|
|
|
|
preview(scope: {
|
|
|
|
|
/**
|
|
|
|
|
* Style class of the preview image element.
|
|
|
|
|
*/
|
|
|
|
|
class: any;
|
|
|
|
|
/**
|
|
|
|
|
* Style of the preview image element.
|
|
|
|
|
*/
|
|
|
|
|
style: any;
|
|
|
|
|
/**
|
|
|
|
|
* Preview click function.
|
2023-10-31 17:21:47 +00:00
|
|
|
|
* @deprecated since v3.39.0. Use 'previewCallback' property instead.
|
2023-05-03 17:54:50 +00:00
|
|
|
|
*/
|
2023-08-17 07:16:25 +00:00
|
|
|
|
onClick: () => void;
|
2023-10-31 17:21:47 +00:00
|
|
|
|
/**
|
2024-05-06 10:45:36 +00:00
|
|
|
|
* Preview click function.
|
|
|
|
|
*/
|
|
|
|
|
previewCallback: () => void;
|
|
|
|
|
}): VNode[];
|
|
|
|
|
/**
|
|
|
|
|
* Custom original template.
|
|
|
|
|
* @param {Object} scope - original slot's params.
|
|
|
|
|
*/
|
|
|
|
|
original(scope: {
|
|
|
|
|
/**
|
|
|
|
|
* Style class of the original image element.
|
|
|
|
|
*/
|
|
|
|
|
class: any;
|
|
|
|
|
/**
|
|
|
|
|
* Style of the original image element.
|
|
|
|
|
*/
|
|
|
|
|
style: any;
|
|
|
|
|
/**
|
|
|
|
|
* Original click function.
|
|
|
|
|
* @deprecated since v3.39.0. Use 'previewCallback' property instead.
|
|
|
|
|
*/
|
|
|
|
|
onClick: () => void;
|
|
|
|
|
/**
|
2023-10-31 17:21:47 +00:00
|
|
|
|
* Preview click function.
|
|
|
|
|
*/
|
|
|
|
|
previewCallback: () => void;
|
2023-05-03 17:54:50 +00:00
|
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-16 10:50:43 +00:00
|
|
|
|
interface ImageEmitsOptions {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
2024-05-16 10:50:43 +00:00
|
|
|
|
export declare type ImageEmits = EmitFn<ImageEmitsOptions>;
|
|
|
|
|
|
|
|
|
|
export interface ImageMethods {
|
2022-09-06 12:03:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* Triggered when the preview overlay is shown.
|
|
|
|
|
*
|
|
|
|
|
* @memberof Image
|
|
|
|
|
*/
|
2023-03-01 15:05:23 +00:00
|
|
|
|
show(): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* Triggered when the preview overlay is hidden.
|
|
|
|
|
*
|
|
|
|
|
* @memberof Image
|
|
|
|
|
*/
|
2023-03-01 15:05:23 +00:00
|
|
|
|
hide(): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* Triggered when an error occurs while loading an image file.
|
2022-09-14 11:26:01 +00:00
|
|
|
|
*
|
2022-09-06 12:03:37 +00:00
|
|
|
|
* @memberof Image
|
|
|
|
|
*/
|
2023-03-01 15:05:23 +00:00
|
|
|
|
error(): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-16 10:50:43 +00:00
|
|
|
|
/**
|
|
|
|
|
* **PrimeVue - Image**
|
|
|
|
|
*
|
|
|
|
|
* _Displays an image with preview and tranformation options. For multiple image, see Galleria._
|
|
|
|
|
*
|
|
|
|
|
* [Live Demo](https://www.primevue.org/image/)
|
|
|
|
|
* --- ---
|
|
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
|
|
|
|
*
|
|
|
|
|
* @group Component
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
declare const Image: DefineComponent<ImageProps, ImageSlots, ImageEmits, ImageMethods>;
|
|
|
|
|
|
2024-03-14 22:58:11 +00:00
|
|
|
|
declare module 'vue' {
|
|
|
|
|
export interface GlobalComponents {
|
2024-05-16 10:50:43 +00:00
|
|
|
|
Image: GlobalComponentConstructor<ImageProps, ImageSlots, ImageEmits, ImageMethods>;
|
2022-09-06 12:03:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Image;
|