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

361 lines
9.3 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';
import { ClassComponent, GlobalComponentConstructor, PTOptions } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type DialogPassThroughOptionType = DialogPassThroughAttributes | ((options: DialogPassThroughMethodOptions) => DialogPassThroughAttributes | string) | string | null | undefined;
2023-04-24 09:59:20 +00:00
2023-08-02 14:07:22 +00:00
export declare type DialogPassThroughTransitionType = TransitionProps | ((options: DialogPassThroughMethodOptions) => TransitionProps) | undefined;
2023-04-24 09:59:20 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface DialogPassThroughMethodOptions {
2023-07-06 12:01:33 +00:00
instance: any;
2023-04-24 09:59:20 +00:00
props: DialogProps;
state: DialogState;
}
/**
* Custom passthrough(pt) options.
* @see {@link DialogProps.pt}
*/
export interface DialogPassThroughOptions {
/**
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;
/**
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;
/**
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
*/
headerTitle?: DialogPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the header icons' DOM element.
2023-04-24 09:59:20 +00:00
*/
headerIcons?: DialogPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the maximizable button's DOM element.
2023-04-24 09:59:20 +00:00
*/
maximizableButton?: DialogPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the maximizable icon's DOM element.
2023-04-24 09:59:20 +00:00
*/
maximizableIcon?: DialogPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the close button's component.
2023-04-24 09:59:20 +00:00
*/
2023-05-03 14:16:11 +00:00
closeButton?: DialogPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the close button icon's component.
2023-05-03 14:16:11 +00:00
*/
closeButtonIcon?: DialogPassThroughOptionType;
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;
/**
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;
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;
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-08-02 12:00:42 +00:00
/**
* Used to control Vue Transition API.
*/
2023-08-02 14:07:22 +00:00
transition?: DialogPassThroughTransitionType;
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] {
* width: ${breakpoint[value]} !important;
* }
* }
*/
[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
/**
2023-08-01 14:01:12 +00:00
* Used to pass all properties of the HTMLDivElement to the overlay panel 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;
/**
* 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
*/
2023-03-01 10:18:34 +00:00
appendTo?: 'body' | 'self' | string | 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;
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?: PTOptions<DialogPassThroughOptions>;
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.
*/
closeicon(): VNode[];
/**
* Custom maximize icon template of dialog.
* @param {Object} scope - maximize icon slot's params.
*/
maximizeicon(scope: {
/**
* Maximized state as a boolean
*/
maximized: boolean;
}): 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/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Dialog: GlobalComponentConstructor<Dialog>;
2022-09-06 12:03:37 +00:00
}
}
export default Dialog;