2023-03-01 08:50:24 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* ConfirmDialog uses a Dialog UI with confirmDialog method or <ConfirmDialog> tag.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/confirmdialog)
|
|
|
|
*
|
|
|
|
* @module confirmdialog
|
|
|
|
*
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
import { VNode } from 'vue';
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2023-05-02 08:01:27 +00:00
|
|
|
import { ButtonPassThroughOptions } from '../button';
|
2022-09-06 12:03:37 +00:00
|
|
|
import { ConfirmationOptions } from '../confirmationoptions';
|
2023-09-05 08:50:46 +00:00
|
|
|
import { PassThroughOptions } from '../passthrough';
|
2023-09-05 11:28:04 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-07-11 22:42:43 +00:00
|
|
|
export declare type ConfirmDialogPassThroughOptionType = ConfirmDialogPassThroughAttributes | ((options: ConfirmDialogPassThroughMethodOptions) => ConfirmDialogPassThroughAttributes | string) | string | null | undefined;
|
2023-04-25 09:58:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface ConfirmDialogPassThroughMethodOptions {
|
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-04-25 09:58:01 +00:00
|
|
|
props: ConfirmDialogProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
2023-04-25 09:58:01 +00:00
|
|
|
state: ConfirmDialogState;
|
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-04-25 09:58:01 +00:00
|
|
|
}
|
|
|
|
|
2023-12-05 07:06:55 +00:00
|
|
|
/**
|
|
|
|
* Custom shared passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface ConfirmDialogSharedPassThroughMethodOptions {
|
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
|
|
|
props: ConfirmDialogProps;
|
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
|
|
|
state: ConfirmDialogState;
|
|
|
|
}
|
|
|
|
|
2023-04-25 09:58:01 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link ConfirmDialogProps.pt}
|
|
|
|
*/
|
|
|
|
export interface ConfirmDialogPassThroughOptions {
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-04-25 09:58:01 +00:00
|
|
|
*/
|
|
|
|
root?: ConfirmDialogPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the header's DOM element.
|
2023-04-25 09:58:01 +00:00
|
|
|
*/
|
|
|
|
header?: ConfirmDialogPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the header title's DOM element.
|
2023-04-25 09:58:01 +00:00
|
|
|
*/
|
2023-11-20 10:07:00 +00:00
|
|
|
title?: ConfirmDialogPassThroughOptionType;
|
2023-04-25 09:58:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the header icons' DOM element.
|
2023-04-25 09:58:01 +00:00
|
|
|
*/
|
2023-11-20 10:07:00 +00:00
|
|
|
icons?: ConfirmDialogPassThroughOptionType;
|
2023-04-25 09:58:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the close button's component.
|
2023-04-25 09:58:01 +00:00
|
|
|
*/
|
2023-05-03 14:16:11 +00:00
|
|
|
closeButton?: ConfirmDialogPassThroughOptionType;
|
2023-04-25 09:58:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the close button icon's component.
|
2023-04-25 09:58:01 +00:00
|
|
|
*/
|
2023-05-03 14:16:11 +00:00
|
|
|
closeButtonIcon?: ConfirmDialogPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the content's DOM element.
|
2023-05-03 14:16:11 +00:00
|
|
|
*/
|
|
|
|
content?: ConfirmDialogPassThroughOptionType;
|
2023-04-25 09:58:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the icon's DOM element.
|
2023-04-25 09:58:01 +00:00
|
|
|
*/
|
|
|
|
icon?: ConfirmDialogPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the message's DOM element.
|
2023-04-25 09:58:01 +00:00
|
|
|
*/
|
|
|
|
message?: ConfirmDialogPassThroughOptionType;
|
2023-05-03 14:16:11 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the footer's DOM element.
|
2023-05-03 14:16:11 +00:00
|
|
|
*/
|
|
|
|
footer?: ConfirmDialogPassThroughOptionType;
|
2023-04-25 09:58:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the Button component.
|
2023-05-02 08:01:27 +00:00
|
|
|
* @see {@link ButtonPassThroughOptions}
|
2023-04-25 09:58:01 +00:00
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
rejectButton?: ButtonPassThroughOptions<ConfirmDialogSharedPassThroughMethodOptions>;
|
2023-04-25 09:58:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the Button component.
|
2023-05-02 08:01:27 +00:00
|
|
|
* @see {@link ButtonPassThroughOptions}
|
2023-04-25 09:58:01 +00:00
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
acceptButton?: ButtonPassThroughOptions<ConfirmDialogSharedPassThroughMethodOptions>;
|
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-04-25 09:58:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface ConfirmDialogPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in ConfirmDialog component.
|
|
|
|
*/
|
|
|
|
export interface ConfirmDialogState {
|
|
|
|
/**
|
|
|
|
* Current visible state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
visible: boolean;
|
|
|
|
/**
|
|
|
|
* Current confirmation message.
|
|
|
|
*/
|
|
|
|
confirmation: any;
|
|
|
|
}
|
|
|
|
|
2023-03-01 08:50:24 +00:00
|
|
|
/**
|
|
|
|
* Breakpoint metadata.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface ConfirmDialogBreakpoints {
|
|
|
|
/**
|
|
|
|
* Breakpoint for responsive mode.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
*
|
|
|
|
* <ConfirmDialog :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 08:50:24 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in ConfirmDialog component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface ConfirmDialogProps {
|
|
|
|
/**
|
|
|
|
* Optional key to match the key of the confirmation, useful to target a specific confirm dialog instance.
|
|
|
|
*/
|
|
|
|
group?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Object literal to define widths per screen size.
|
|
|
|
* @see ConfirmDialogBreakpoints
|
|
|
|
*/
|
|
|
|
breakpoints?: ConfirmDialogBreakpoints;
|
2023-03-16 14:37:09 +00:00
|
|
|
/**
|
|
|
|
* Enables dragging to change the position using header.
|
|
|
|
* @defaultValue true
|
|
|
|
*/
|
|
|
|
draggable?: boolean | undefined;
|
2023-04-25 09:58:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-04-25 09:58:01 +00:00
|
|
|
* @type {ConfirmDialogPassThroughOptions}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<ConfirmDialogPassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
2023-05-29 17:44:31 +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 08:50:24 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in ConfirmDialog component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface ConfirmDialogSlots {
|
|
|
|
/**
|
|
|
|
* Custom message template.
|
|
|
|
* @param {Object} scope - message slot's params.
|
|
|
|
*/
|
2023-04-19 06:49:03 +00:00
|
|
|
message(scope: {
|
|
|
|
/**
|
|
|
|
* Message of the component
|
|
|
|
*/
|
|
|
|
message: ConfirmationOptions;
|
|
|
|
}): VNode[];
|
2023-04-18 11:50:19 +00:00
|
|
|
/**
|
|
|
|
* Custom icon template.
|
2023-08-17 07:16:25 +00:00
|
|
|
* @param {Object} scope - icon slot's params.
|
2023-04-18 11:50:19 +00:00
|
|
|
*/
|
2023-04-19 06:49:03 +00:00
|
|
|
icon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the icon template
|
|
|
|
*/
|
|
|
|
class: any;
|
|
|
|
}): VNode[];
|
2023-04-18 11:50:19 +00:00
|
|
|
/**
|
|
|
|
* Custom icon template.
|
|
|
|
*/
|
|
|
|
accepticon(): VNode[];
|
|
|
|
/**
|
|
|
|
* Custom icon template.
|
|
|
|
*/
|
|
|
|
rejecticon(): VNode[];
|
2023-09-19 10:51:23 +00:00
|
|
|
/**
|
|
|
|
* Custom container slot.
|
|
|
|
* @param {Object} scope - container slot's params.
|
|
|
|
*/
|
|
|
|
container(scope: {
|
|
|
|
/**
|
|
|
|
* Message of the component
|
|
|
|
*/
|
|
|
|
message: any;
|
|
|
|
/**
|
|
|
|
* Close dialog function.
|
2023-10-31 12:52:10 +00:00
|
|
|
* @deprecated since v3.39.0. Use 'closeCallback' property instead.
|
2023-09-19 10:51:23 +00:00
|
|
|
*/
|
|
|
|
onClose: () => void;
|
2023-09-19 11:16:07 +00:00
|
|
|
/**
|
|
|
|
* Accept function of the component
|
2023-10-31 12:52:10 +00:00
|
|
|
* @deprecated since v3.39.0. Use 'acceptCallback' property instead.
|
2023-09-19 11:16:07 +00:00
|
|
|
*/
|
|
|
|
onAccept: () => void;
|
|
|
|
/**
|
|
|
|
* Reject function of the component
|
2023-10-31 12:52:10 +00:00
|
|
|
* @deprecated since v3.39.0. Use 'rejectCallback' property instead.
|
2023-09-19 11:16:07 +00:00
|
|
|
*/
|
|
|
|
onReject: () => void;
|
2023-10-31 12:52:10 +00:00
|
|
|
/**
|
|
|
|
* Close dialog function.
|
|
|
|
*/
|
|
|
|
closeCallback: () => void;
|
|
|
|
/**
|
|
|
|
* Accept function of the component
|
|
|
|
*/
|
|
|
|
acceptCallback: () => void;
|
|
|
|
/**
|
|
|
|
* Reject function of the component
|
|
|
|
*/
|
|
|
|
rejectCallback: () => void;
|
2023-09-19 10:51:23 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 08:50:24 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in ConfirmDialog component.
|
|
|
|
*/
|
|
|
|
export interface ConfirmDialogEmits {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 08:50:24 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - ConfirmDialog**
|
|
|
|
*
|
|
|
|
* _ConfirmDialog uses a Dialog UI with confirmDialog method or <ConfirmDialog> tag._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/confirmdialog/)
|
|
|
|
* --- ---
|
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*/
|
2023-03-01 14:48:23 +00:00
|
|
|
declare class ConfirmDialog extends ClassComponent<ConfirmDialogProps, ConfirmDialogSlots, ConfirmDialogEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
ConfirmDialog: GlobalComponentConstructor<ConfirmDialog>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ConfirmDialog;
|