From 6ec5a5c8b30f64866a49a5942882205746949fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Fri, 28 Apr 2023 14:56:49 +0300 Subject: [PATCH] Refactor #3911 - For Message --- api-generator/components/message.js | 6 +++ components/lib/message/Message.d.ts | 60 ++++++++++++++++++++++++++++- components/lib/message/Message.vue | 16 ++++---- 3 files changed, 74 insertions(+), 8 deletions(-) diff --git a/api-generator/components/message.js b/api-generator/components/message.js index 02be57a06..8f6e648fe 100644 --- a/api-generator/components/message.js +++ b/api-generator/components/message.js @@ -34,6 +34,12 @@ const MessageProps = [ type: 'string', default: 'undefined', description: 'Display a custom close icon for the message.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/components/lib/message/Message.d.ts b/components/lib/message/Message.d.ts index 49d7cae0b..a9a8c7df3 100755 --- a/components/lib/message/Message.d.ts +++ b/components/lib/message/Message.d.ts @@ -10,6 +10,65 @@ import { ButtonHTMLAttributes, VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +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; +} + +/** + * 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; +} + /** * Defines valid properties in Message component. */ @@ -45,7 +104,6 @@ export interface MessageProps { closeIcon?: string | undefined; /** * Uses to pass all properties of the HTMLButtonElement to the close button. - * @deprecated since v3.26.0. Use 'pt' property. */ closeButtonProps?: ButtonHTMLAttributes | undefined; } diff --git a/components/lib/message/Message.vue b/components/lib/message/Message.vue index 6083c6c9f..2727dd94f 100755 --- a/components/lib/message/Message.vue +++ b/components/lib/message/Message.vue @@ -1,17 +1,17 @@