2023-03-01 12:59:47 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Message groups a collection of contents in tabs.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/message/)
|
|
|
|
*
|
|
|
|
* @module message
|
|
|
|
*
|
|
|
|
*/
|
2022-12-08 11:04:25 +00:00
|
|
|
import { ButtonHTMLAttributes, VNode } from 'vue';
|
2023-07-06 11:09:01 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent/BaseComponent';
|
2022-09-06 12:03:37 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
|
|
|
|
2023-04-28 11:56:49 +00:00
|
|
|
export declare type MessagePassThroughOptionType = MessagePassThroughAttributes | ((options: MessagePassThroughMethodOptions) => MessagePassThroughAttributes) | null | undefined;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface MessagePassThroughMethodOptions {
|
|
|
|
props: MessageProps;
|
|
|
|
state: MessageState;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link MessageProps.pt}
|
|
|
|
*/
|
|
|
|
export interface MessagePassThroughOptions {
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the root's DOM element.
|
|
|
|
*/
|
|
|
|
root?: MessagePassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the wrapper's DOM element.
|
|
|
|
*/
|
|
|
|
wrapper?: MessagePassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the icon's DOM element.
|
|
|
|
*/
|
|
|
|
icon?: MessagePassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the text's DOM element.
|
|
|
|
*/
|
|
|
|
text?: MessagePassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the button's DOM element.
|
|
|
|
*/
|
|
|
|
button?: MessagePassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the button icon's DOM element.
|
|
|
|
*/
|
|
|
|
buttonIcon?: MessagePassThroughOptionType;
|
2023-07-06 11:09:01 +00:00
|
|
|
/**
|
|
|
|
* Uses to manage all lifecycle hooks
|
|
|
|
* @see {@link BaseComponent.ComponentHooks}
|
|
|
|
*/
|
|
|
|
hooks?: ComponentHooks;
|
2023-04-28 11:56:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface MessagePassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in Message component.
|
|
|
|
*/
|
|
|
|
export interface MessageState {
|
|
|
|
/**
|
|
|
|
* Current visible state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
visible: boolean;
|
|
|
|
}
|
|
|
|
|
2023-03-01 12:59:47 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in Message component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface MessageProps {
|
|
|
|
/**
|
|
|
|
* Severity level of the message.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue info
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-27 08:09:36 +00:00
|
|
|
severity?: 'success' | 'info' | 'warn' | 'error' | string | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Whether the message can be closed manually using the close icon.
|
2023-03-01 12:59:47 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
closable?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* When enabled, message is not removed automatically.
|
2023-03-01 12:59:47 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
sticky?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Delay in milliseconds to close the message automatically.
|
2023-03-01 12:59:47 +00:00
|
|
|
* @defaultValue 3000
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
life?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Display a custom icon for the message.
|
|
|
|
*/
|
|
|
|
icon?: string | undefined;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Icon to display in the message close button.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'closeicon' slot.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
closeIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Uses to pass all properties of the HTMLButtonElement to the close button.
|
|
|
|
*/
|
|
|
|
closeButtonProps?: ButtonHTMLAttributes | undefined;
|
2023-04-28 13:40:36 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to DOM elements inside the component.
|
|
|
|
* @type {MessagePassThroughOptions}
|
|
|
|
*/
|
|
|
|
pt?: MessagePassThroughOptions;
|
2023-05-25 13:22:28 +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 12:59:47 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in Message slots.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface MessageSlots {
|
|
|
|
/**
|
|
|
|
* Default custom slot.
|
|
|
|
*/
|
2023-03-01 12:59:47 +00:00
|
|
|
default(): VNode[];
|
2023-04-07 14:15:21 +00:00
|
|
|
/**
|
|
|
|
* Custom message icon template.
|
|
|
|
*/
|
2023-04-18 10:51:10 +00:00
|
|
|
messageicon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the item icon element.
|
|
|
|
*/
|
|
|
|
class: any;
|
|
|
|
}): VNode[];
|
2023-04-07 14:15:21 +00:00
|
|
|
/**
|
|
|
|
* Custom close icon template.
|
|
|
|
*/
|
2023-04-18 10:51:10 +00:00
|
|
|
closeicon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the item icon element.
|
|
|
|
*/
|
|
|
|
class: any;
|
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 12:59:47 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in Message component.
|
|
|
|
*/
|
|
|
|
export interface MessageEmits {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when a message is closed.
|
|
|
|
* @param {Event} event - Browser event.
|
|
|
|
*/
|
2023-03-01 12:59:47 +00:00
|
|
|
close(event: Event): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 12:59:47 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - Message**
|
|
|
|
*
|
|
|
|
* _Messages is used to display inline messages with various severities._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/message/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-01 12:59:47 +00:00
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
declare class Message extends ClassComponent<MessageProps, MessageSlots, MessageEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
Message: GlobalComponentConstructor<Message>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Message;
|