primevue-mirror/components/lib/dialog/Dialog.d.ts

450 lines
12 KiB
TypeScript
Raw Normal View History

2023-03-01 10:18:34 +00:00
/**
*
* Dialog is a container to display content in an overlay window.
*
* [Live Demo](https://www.primevue.org/dialog)
*
* @module dialog
*
*/
2023-08-02 14:07:22 +00:00
import { HTMLAttributes, TransitionProps, VNode } from 'vue';
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
2024-04-15 08:08:42 +00:00
import { ButtonPassThroughOptions, ButtonProps } from '../button';
2023-09-05 08:50:46 +00:00
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, DesignToken, GlobalComponentConstructor, HintedString, PassThrough } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type DialogPassThroughOptionType<T = any> = DialogPassThroughAttributes | ((options: DialogPassThroughMethodOptions<T>) => DialogPassThroughAttributes | string) | string | null | undefined;
2023-04-24 09:59:20 +00:00
export declare type DialogPassThroughTransitionType<T = any> = TransitionProps | ((options: DialogPassThroughMethodOptions<T>) => TransitionProps) | undefined;
2023-08-02 14:07:22 +00:00
2023-04-24 09:59:20 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface DialogPassThroughMethodOptions<T> {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-04-24 09:59:20 +00:00
props: DialogProps;
/**
* Defines current inline state.
*/
2023-04-24 09:59:20 +00:00
state: DialogState;
/**
* Defines parent instance.
*/
parent: T;
2023-09-05 08:50:46 +00:00
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
2023-04-24 09:59:20 +00:00
}
2024-04-15 08:08:42 +00:00
/**
* Custom shared passthrough(pt) option method.
*/
export interface DialogSharedPassThroughMethodOptions {
/**
* Defines valid properties.
*/
props: DialogProps;
/**
* Defines current inline state.
*/
state: DialogState;
}
2023-04-24 09:59:20 +00:00
/**
* Custom passthrough(pt) options.
* @see {@link DialogProps.pt}
*/
export interface DialogPassThroughOptions<T = any> {
2023-04-24 09:59:20 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
2023-04-24 09:59:20 +00:00
*/
root?: DialogPassThroughOptionType<T>;
2023-04-24 09:59:20 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the header's DOM element.
2023-04-24 09:59:20 +00:00
*/
header?: DialogPassThroughOptionType<T>;
2023-04-24 09:59:20 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the header title's DOM element.
2023-04-24 09:59:20 +00:00
*/
title?: DialogPassThroughOptionType<T>;
2023-04-24 09:59:20 +00:00
/**
* Used to pass attributes to the header actions' DOM element.
2023-04-24 09:59:20 +00:00
*/
headerActions?: DialogPassThroughOptionType<T>;
2023-04-24 09:59:20 +00:00
/**
2024-05-06 13:10:13 +00:00
* Used to pass attributes to the maximize Button component.
2024-04-15 08:08:42 +00:00
* @see {@link ButtonPassThroughOptions}
2023-04-24 09:59:20 +00:00
*/
2024-05-06 13:10:13 +00:00
maximizeButton?: ButtonPassThroughOptions<DialogSharedPassThroughMethodOptions>;
2023-05-03 14:16:11 +00:00
/**
2024-04-15 08:08:42 +00:00
* Used to pass attributes to the close Button component.
* @see {@link ButtonPassThroughOptions}
2023-05-03 14:16:11 +00:00
*/
2024-04-15 08:08:42 +00:00
closeButton?: ButtonPassThroughOptions<DialogSharedPassThroughMethodOptions>;
2023-04-24 09:59:20 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the content's DOM element.
2023-04-24 09:59:20 +00:00
*/
content?: DialogPassThroughOptionType<T>;
2023-04-24 09:59:20 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the footer's DOM element.
2023-04-24 09:59:20 +00:00
*/
footer?: DialogPassThroughOptionType<T>;
2023-04-26 13:41:27 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the mask's DOM element.
2023-04-26 13:41:27 +00:00
*/
mask?: DialogPassThroughOptionType<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-08-02 12:00:42 +00:00
/**
* Used to control Vue Transition API.
*/
transition?: DialogPassThroughTransitionType<T>;
2023-04-24 09:59:20 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface DialogPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Dialog component.
*/
export interface DialogState {
/**
* Current visible state of the container as a boolean.
* @defaultValue false
*/
containerVisible: boolean;
/**
* Current maximized state as a boolean.
* @defaultValue false
*/
maximized: boolean;
}
2023-03-01 10:18:34 +00:00
/**
* Custom breakpoint metadata.
*/
2022-09-06 12:03:37 +00:00
export interface DialogBreakpoints {
/**
* Breakpoint for responsive mode.
*
* Example:
*
* <Dialog :breakpoints="{'960px': '75vw', '640px': '100vw'}" ... />
*
* Result:
*
* @media screen and (max-width: ${breakpoint[key]}) {
* .p-dialog[attributeSelector] {
2023-12-21 07:56:38 +00:00
* width: ${breakpoint[value]} !important;
2022-09-06 12:03:37 +00:00
* }
* }
*/
[key: string]: string;
}
2023-03-01 10:18:34 +00:00
/**
* Defines valid properties in Dialog component.
*/
2022-09-06 12:03:37 +00:00
export interface DialogProps {
/**
* Title content of the dialog.
*/
header?: string | undefined;
/**
* Footer content of the dialog.
*/
footer?: string | undefined;
/**
* Specifies the visibility of the dialog.
2023-03-01 10:18:34 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
visible?: boolean | undefined;
/**
* Defines if background should be blocked when dialog is displayed.
2023-03-01 10:18:34 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
modal?: boolean | undefined;
/**
* Style of the content section.
*/
contentStyle?: any;
/**
* Style class of the content section.
*/
contentClass?: any;
2022-12-08 11:04:25 +00:00
/**
2024-04-15 08:08:42 +00:00
* Used to pass all properties of the HTMLDivElement to the overlay Dialog inside the component.
2022-12-08 11:04:25 +00:00
*/
contentProps?: HTMLAttributes | undefined;
2022-09-06 12:03:37 +00:00
/**
* When enabled dialog is displayed in RTL direction.
2023-03-01 10:18:34 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
rtl?: boolean | undefined;
/**
* Adds a close icon to the header to hide the dialog.
2023-03-01 10:18:34 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
closable?: boolean | undefined;
/**
* Specifies if clicking the modal background should hide the dialog.
2023-03-01 10:18:34 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
dismissableMask?: boolean | undefined;
/**
* Specifies if pressing escape key should hide the dialog.
2023-03-01 10:18:34 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
closeOnEscape?: boolean | undefined;
/**
* Whether to show the header or not.
2023-03-01 10:18:34 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
showHeader?: boolean | undefined;
/**
* Whether background scroll should be blocked when dialog is visible.
* @defaultValue false
*/
blockScroll?: boolean | undefined;
2022-09-06 12:03:37 +00:00
/**
* Base zIndex value to use in layering.
2023-03-01 10:18:34 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
baseZIndex?: number | undefined;
/**
* Whether to automatically manage layering.
2023-03-01 10:18:34 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
autoZIndex?: boolean | undefined;
/**
2023-03-01 10:18:34 +00:00
* Position of the dialog.
2023-03-08 10:51:52 +00:00
* @defaultValue center
2022-09-06 12:03:37 +00:00
*/
2023-03-01 10:18:34 +00:00
position?: 'center' | 'top' | 'bottom' | 'left' | 'right' | 'topleft' | 'topright' | 'bottomleft' | 'bottomright' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Whether the dialog can be displayed full screen.
2023-03-01 10:18:34 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
maximizable?: boolean | undefined;
/**
* Object literal to define widths per screen size.
*/
breakpoints?: DialogBreakpoints;
/**
* Enables dragging to change the position using header.
2023-03-01 10:18:34 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
draggable?: boolean | undefined;
/**
* Keeps dialog in the viewport when dragging.
2023-03-01 10:18:34 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
keepInViewPort?: boolean | undefined;
/**
* Minimum value for the left coordinate of dialog in dragging.
2023-03-01 10:18:34 +00:00
* @defaultValue 0.
2022-09-06 12:03:37 +00:00
*/
minX?: number | undefined;
/**
* Minimum value for the top coordinate of dialog in dragging.
2023-03-01 10:18:34 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
minY?: number | undefined;
/**
2023-03-01 10:18:34 +00:00
* A valid query selector or an HTMLElement to specify where the dialog gets attached.
2023-03-08 10:51:52 +00:00
* @defaultValue body
2022-09-06 12:03:37 +00:00
*/
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
2022-09-06 12:03:37 +00:00
/**
* Style of the dynamic dialog.
*/
style?: any;
2022-12-08 11:04:25 +00:00
/**
* Icon to display in the dialog close button.
* @deprecated since v3.27.0. Use 'closeicon' slot.
2022-12-08 11:04:25 +00:00
*/
closeIcon?: string | undefined;
/**
* Icon to display in the dialog maximize button when dialog is not maximized.
* @deprecated since v3.27.0. Use 'maximizeicon' slot.
2022-12-08 11:04:25 +00:00
*/
maximizeIcon?: string | undefined;
/**
* Icon to display in the dialog maximize button when dialog is minimized.
* @deprecated since v3.27.0. Use 'minimizeicon' slot.
2022-12-08 11:04:25 +00:00
*/
minimizeIcon?: string | undefined;
2024-04-15 08:08:42 +00:00
/**
* Used to pass all properties of the ButtonProps to the Button component.
* @type {ButtonProps}
* @defaultValue { severity: 'secondary', rounded: true, text: true }
*/
closeButtonProps?: object | undefined;
/**
* Used to pass all properties of the ButtonProps to the Button component.
* @type {ButtonProps}
* @defaultValue { severity: 'secondary', rounded: true, text: true }
*/
maximizeButtonProps?: object | undefined;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
2023-04-24 09:59:20 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-04-24 09:59:20 +00:00
* @type {DialogPassThroughOptions}
*/
pt?: PassThrough<DialogPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
2023-05-29 10:59:47 +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 10:18:34 +00:00
/**
* Defines valid slots in Dialog component.
*/
2022-09-06 12:03:37 +00:00
export interface DialogSlots {
/**
* Default content slot.
*/
2023-03-01 10:18:34 +00:00
default(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom header template.
*/
2023-03-01 10:18:34 +00:00
header(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom footer template.
*/
2023-03-01 10:18:34 +00:00
footer(): VNode[];
/**
* Custom close icon template.
* @param {Object} scope - close icon slot's params.
*/
closeicon(scope: {
/**
* Style class of the close icon
*/
class: any;
}): VNode[];
/**
* Custom maximize icon template of dialog.
* @param {Object} scope - maximize icon slot's params.
*/
maximizeicon(scope: {
/**
* Maximized state as a boolean
*/
maximized: boolean;
/**
* Style class of the maximize icon
*/
class: any;
}): VNode[];
/**
* Custom container slot.
* @param {Object} scope - container slot's params.
*/
container(scope: {
/**
* Close dialog function.
* @deprecated since v3.39.0. Use 'closeCallback' property instead.
*/
onClose: () => void;
/**
* Maximize/minimize dialog function.
* @param {Event} event - Browser event
* @deprecated since v3.39.0. Use 'maximizeCallback' property instead.
*/
onMaximize: (event: Event) => void;
/**
* Close dialog function.
*/
closeCallback: () => void;
/**
* Maximize/minimize dialog function.
* @param {Event} event - Browser event
*/
maximizeCallback: (event: Event) => void;
}): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 10:18:34 +00:00
/**
* Defines valid emits in Dialog component.
*/
export interface DialogEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the visible changes.
* @param {boolean} value - New value.
*/
2023-03-01 10:18:34 +00:00
'update:visible'(value: boolean): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when dialog is hidden.
*/
2023-03-01 10:18:34 +00:00
hide(): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke after dialog is hidden.
2022-09-14 11:26:01 +00:00
*/
2023-03-01 10:18:34 +00:00
'after-hide'(): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when dialog is shown.
*/
2023-03-01 10:18:34 +00:00
show(): void;
2022-09-06 12:03:37 +00:00
/**
* Fired when a dialog gets maximized.
* @param {event} event - Browser event.
*/
2023-03-01 10:18:34 +00:00
maximize(event: Event): void;
2022-09-06 12:03:37 +00:00
/**
* Fired when a dialog gets unmaximized.
* @param {event} event - Browser event.
*/
2023-03-01 10:18:34 +00:00
unmaximize(event: Event): void;
2022-09-06 12:03:37 +00:00
/**
* Fired when a dialog drag completes.
* @param {event} event - Browser event.
*/
2023-03-01 10:18:34 +00:00
dragend(event: Event): void;
}
2022-09-06 12:03:37 +00:00
2023-03-01 10:18:34 +00:00
/**
* **PrimeVue - Dialog**
*
* _Dialog is a container to display content in an overlay window._
*
* [Live Demo](https://www.primevue.org/dialog/)
* --- ---
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
*
* @group Component
*/
2023-03-01 14:48:23 +00:00
declare class Dialog extends ClassComponent<DialogProps, DialogSlots, DialogEmits> {}
2022-09-06 12:03:37 +00:00
declare module 'vue' {
export interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Dialog: GlobalComponentConstructor<Dialog>;
2022-09-06 12:03:37 +00:00
}
}
export default Dialog;