2022-12-08 11:04:25 +00:00
|
|
|
import { HTMLAttributes, VNode } from 'vue';
|
2022-09-06 12:03:37 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
|
|
|
|
|
|
|
type DialogPositionType = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'topleft' | 'topright' | 'bottomleft' | 'bottomright' | undefined;
|
|
|
|
|
|
|
|
type DialogAppendToType = 'body' | 'self' | string | undefined | HTMLElement;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
visible?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Defines if background should be blocked when dialog is displayed.
|
|
|
|
*/
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Uses to pass all properties of the HTMLDivElement to the overlay panel inside the component.
|
|
|
|
*/
|
|
|
|
contentProps?: HTMLAttributes | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* When enabled dialog is displayed in RTL direction.
|
|
|
|
*/
|
|
|
|
rtl?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Adds a close icon to the header to hide the dialog.
|
|
|
|
* Default value is true.
|
|
|
|
*/
|
|
|
|
closable?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Specifies if clicking the modal background should hide the dialog.
|
|
|
|
*/
|
|
|
|
dismissableMask?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Specifies if pressing escape key should hide the dialog.
|
|
|
|
* Default value is true.
|
|
|
|
*/
|
|
|
|
closeOnEscape?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Whether to show the header or not.
|
|
|
|
* Default value is true.
|
|
|
|
*/
|
|
|
|
showHeader?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Base zIndex value to use in layering.
|
|
|
|
* Default value is 0.
|
|
|
|
*/
|
|
|
|
baseZIndex?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Whether to automatically manage layering.
|
|
|
|
* Default value is true.
|
|
|
|
*/
|
|
|
|
autoZIndex?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Position of the dialog, options are 'center', 'top', 'bottom', 'left', 'right', 'topleft', 'topright', 'bottomleft' or 'bottomright'.
|
|
|
|
* @see DialogPositionType
|
|
|
|
* Default value is 'center'.
|
|
|
|
*/
|
|
|
|
position?: DialogPositionType;
|
|
|
|
/**
|
|
|
|
* Whether the dialog can be displayed full screen.
|
|
|
|
*/
|
|
|
|
maximizable?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Object literal to define widths per screen size.
|
|
|
|
* @see DialogBreakpoints
|
|
|
|
*/
|
|
|
|
breakpoints?: DialogBreakpoints;
|
|
|
|
/**
|
|
|
|
* Enables dragging to change the position using header.
|
|
|
|
* Default value is true.
|
|
|
|
*/
|
|
|
|
draggable?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Keeps dialog in the viewport when dragging.
|
|
|
|
* Default value is true.
|
|
|
|
*/
|
|
|
|
keepInViewPort?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Minimum value for the left coordinate of dialog in dragging.
|
|
|
|
* Default value is 0.
|
|
|
|
*/
|
|
|
|
minX?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Minimum value for the top coordinate of dialog in dragging.
|
|
|
|
* Default value is 0.
|
|
|
|
*/
|
|
|
|
minY?: number | undefined;
|
|
|
|
/**
|
|
|
|
* A valid query selector or an HTMLElement to specify where the dialog gets attached. Special keywords are 'body' for document body and 'self' for the element itself.
|
|
|
|
* @see DialogAppendToType
|
|
|
|
* Default value is 'body'.
|
|
|
|
*/
|
|
|
|
appendTo?: DialogAppendToType;
|
|
|
|
/**
|
|
|
|
* Style of the dynamic dialog.
|
|
|
|
*/
|
|
|
|
style?: any;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Icon to display in the dialog close button.
|
|
|
|
* Default value is 'pi pi-times'.
|
|
|
|
*/
|
|
|
|
closeIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Icon to display in the dialog maximize button when dialog is not maximized.
|
|
|
|
* Default value is 'pi pi-window-maximize'.
|
|
|
|
*/
|
|
|
|
maximizeIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Icon to display in the dialog maximize button when dialog is maximized.
|
|
|
|
* Default value is 'pi pi-window-minimize'.
|
|
|
|
*/
|
|
|
|
minimizeIcon?: string | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface DialogSlots {
|
|
|
|
/**
|
|
|
|
* Default content slot.
|
|
|
|
*/
|
|
|
|
default: () => VNode[];
|
|
|
|
/**
|
|
|
|
* Custom header template.
|
|
|
|
*/
|
|
|
|
header: () => VNode[];
|
|
|
|
/**
|
|
|
|
* Custom footer template.
|
|
|
|
*/
|
|
|
|
footer: () => VNode[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export declare type DialogEmits = {
|
|
|
|
/**
|
|
|
|
* Emitted when the visible changes.
|
|
|
|
* @param {boolean} value - New value.
|
|
|
|
*/
|
|
|
|
'update:visible': (value: boolean) => void;
|
|
|
|
/**
|
|
|
|
* Callback to invoke when dialog is hidden.
|
|
|
|
*/
|
2022-09-14 11:26:01 +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
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
'after-hide': () => void;
|
|
|
|
/**
|
|
|
|
* Callback to invoke when dialog is shown.
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
show: () => void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Fired when a dialog gets maximized.
|
|
|
|
* @param {event} event - Browser event.
|
|
|
|
*/
|
2022-09-14 11:26:01 +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.
|
|
|
|
*/
|
2022-09-14 11:26:01 +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.
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
dragend: (event: Event) => void;
|
|
|
|
};
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2022-09-14 11:26:01 +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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Dialog is a container to display content in an overlay window.
|
|
|
|
*
|
|
|
|
* Demos:
|
|
|
|
*
|
2022-09-14 11:26:01 +00:00
|
|
|
* - [Dialog](https://www.primefaces.org/primevue/dialog)
|
2022-09-06 12:03:37 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
export default Dialog;
|