From 02c1df89320e0831e5f0c2e53eacc83c92b768f3 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: Mon, 24 Apr 2023 14:44:13 +0300 Subject: [PATCH] Refactor #3885 - For OverlayPanel --- api-generator/components/overlaypanel.js | 6 ++ components/lib/overlaypanel/OverlayPanel.d.ts | 56 +++++++++++++++++++ components/lib/overlaypanel/OverlayPanel.vue | 10 ++-- 3 files changed, 68 insertions(+), 4 deletions(-) diff --git a/api-generator/components/overlaypanel.js b/api-generator/components/overlaypanel.js index 3cdf363223..f2861c06b3 100644 --- a/api-generator/components/overlaypanel.js +++ b/api-generator/components/overlaypanel.js @@ -46,6 +46,12 @@ const OverlayPanelProps = [ 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/overlaypanel/OverlayPanel.d.ts b/components/lib/overlaypanel/OverlayPanel.d.ts index 247bdf7751..4a1a4a65a7 100755 --- a/components/lib/overlaypanel/OverlayPanel.d.ts +++ b/components/lib/overlaypanel/OverlayPanel.d.ts @@ -10,6 +10,57 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type OverlayPanelPassThroughOptionType = OverlayPanelPassThroughAttributes | ((options: OverlayPanelPassThroughMethodOptions) => OverlayPanelPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface OverlayPanelPassThroughMethodOptions { + props: OverlayPanelProps; + state: OverlayPanelState; +} + +/** + * Custom passthrough(pt) options. + * @see {@link OverlayPanelProps.pt} + */ +export interface OverlayPanelPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: OverlayPanelPassThroughOptionType; + /** + * Uses to pass attributes to the content's DOM element. + */ + content?: OverlayPanelPassThroughOptionType; + /** + * Uses to pass attributes to the close button's DOM element. + */ + closeButton?: OverlayPanelPassThroughOptionType; + /** + * Uses to pass attributes to the close icon's DOM element. + */ + closeIcon?: OverlayPanelPassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface OverlayPanelPassThroughAttributes { + [key: string]: any; +} + +/** + * Defines current inline state in OverlayPanel component. + */ +export interface OverlayPanelState { + /** + * Current visible state as a boolean. + * @defaultValue false + */ + visible: boolean; +} + /** * OverlayPanel breakpoint metadata. */ @@ -70,6 +121,11 @@ export interface OverlayPanelProps { * @deprecated since v3.27.0. Use 'closeicon' slot. */ closeIcon?: string | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {OverlayPanelPassThroughOptions} + */ + pt?: OverlayPanelPassThroughOptions; } /** diff --git a/components/lib/overlaypanel/OverlayPanel.vue b/components/lib/overlaypanel/OverlayPanel.vue index 12cd78cf71..7bc3cf126a 100755 --- a/components/lib/overlaypanel/OverlayPanel.vue +++ b/components/lib/overlaypanel/OverlayPanel.vue @@ -1,13 +1,13 @@