From ca5201e9733a9ff1ff4395c28dfacf08b2584095 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:55:27 +0300 Subject: [PATCH] Refactor #3911 - For InlineMessage --- api-generator/components/inlinemessage.js | 6 +++ .../lib/inlinemessage/InlineMessage.d.ts | 47 +++++++++++++++++++ .../lib/inlinemessage/InlineMessage.vue | 10 ++-- 3 files changed, 60 insertions(+), 3 deletions(-) diff --git a/api-generator/components/inlinemessage.js b/api-generator/components/inlinemessage.js index d9f7fd8aa..0ec46364b 100644 --- a/api-generator/components/inlinemessage.js +++ b/api-generator/components/inlinemessage.js @@ -10,6 +10,12 @@ const InlineMessageProps = [ type: 'string', default: 'undefined', description: 'Display a custom 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/inlinemessage/InlineMessage.d.ts b/components/lib/inlinemessage/InlineMessage.d.ts index 357c90817..aebfbf3e8 100755 --- a/components/lib/inlinemessage/InlineMessage.d.ts +++ b/components/lib/inlinemessage/InlineMessage.d.ts @@ -10,6 +10,53 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type InlineMessagePassThroughOptionType = InlineMessagePassThroughAttributes | ((options: InlineMessagePassThroughMethodOptions) => InlineMessagePassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface InlineMessagePassThroughMethodOptions { + props: InlineMessageProps; + state: InlineMessageState; +} + +/** + * Custom passthrough(pt) options. + * @see {@link InlineMessageProps.pt} + */ +export interface InlineMessagePassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: InlineMessagePassThroughOptionType; + /** + * Uses to pass attributes to the icon's DOM element. + */ + icon?: InlineMessagePassThroughOptionType; + /** + * Uses to pass attributes to the text's DOM element. + */ + text?: InlineMessagePassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface InlineMessagePassThroughAttributes { + [key: string]: any; +} + +/** + * Defines current inline state in InlineMessage component. + */ +export interface InlineMessageState { + /** + * Current visible state as a boolean. + * @defaultValue false + */ + visible: boolean; +} + /** * Defines valid properties in InlineMessage component. */ diff --git a/components/lib/inlinemessage/InlineMessage.vue b/components/lib/inlinemessage/InlineMessage.vue index 03a9abf1e..450726ca8 100755 --- a/components/lib/inlinemessage/InlineMessage.vue +++ b/components/lib/inlinemessage/InlineMessage.vue @@ -1,13 +1,16 @@