From b63bc4db2f849fc334adf4c191ebc15ade84febe 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, 24 Mar 2023 09:46:57 +0300 Subject: [PATCH] Fixed #3794 - TabView: new passthrough(pt) property implementation --- api-generator/components/tabpanel.js | 6 ++ api-generator/components/tabview.js | 24 ++++++- components/lib/tabpanel/TabPanel.d.ts | 54 +++++++++++++++ components/lib/tabpanel/TabPanel.vue | 2 + components/lib/tabview/TabView.d.ts | 97 +++++++++++++++++++++++++++ components/lib/tabview/TabView.vue | 51 ++++++++++---- 6 files changed, 219 insertions(+), 15 deletions(-) diff --git a/api-generator/components/tabpanel.js b/api-generator/components/tabpanel.js index 32af2a89e..14f88357c 100644 --- a/api-generator/components/tabpanel.js +++ b/api-generator/components/tabpanel.js @@ -52,6 +52,12 @@ const TabPanelProps = [ type: 'boolean', default: 'null', description: 'Whether the tab is disabled.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/api-generator/components/tabview.js b/api-generator/components/tabview.js index 210f1d45a..a632fe72a 100644 --- a/api-generator/components/tabview.js +++ b/api-generator/components/tabview.js @@ -40,6 +40,12 @@ const TabViewProps = [ type: 'any', default: 'null', description: 'Uses to pass all properties of the HTMLButtonElement to the next button.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; @@ -78,11 +84,27 @@ const TabViewEvents = [ } ]; +const TabViewSlots = [ + { + name: 'default', + description: 'Default slot to detect TabPanel components.' + }, + { + name: 'previcon', + description: 'Previous button icon template for the scrollable component.' + }, + { + name: 'nexticon', + description: 'Next button icon template for the scrollable component.' + } +]; + module.exports = { tabview: { name: 'TabView', description: 'TabView is a container component to group content with tabs.', props: TabViewProps, - event: TabViewEvents + event: TabViewEvents, + slots: TabViewSlots } }; diff --git a/components/lib/tabpanel/TabPanel.d.ts b/components/lib/tabpanel/TabPanel.d.ts index 267d6a013..91bb5af0d 100755 --- a/components/lib/tabpanel/TabPanel.d.ts +++ b/components/lib/tabpanel/TabPanel.d.ts @@ -8,8 +8,50 @@ * */ import { AnchorHTMLAttributes, HTMLAttributes, LiHTMLAttributes, VNode } from 'vue'; +import { TabViewPassThroughOptions } from '../tabview'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type TabPanelPassThroughOptionType = TabPanelPassThroughAttributes | ((options: TabPanelPassThroughMethodOptions) => TabPanelPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface TabPanelPassThroughMethodOptions { + props: TabPanelProps; + parent: TabViewPassThroughOptions; +} + +/** + * Custom passthrough(pt) options. + * @see {@link TabPanelProps.pt} + */ +export interface TabPanelPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: TabPanelPassThroughOptionType; + /** + * Uses to pass attributes to the header's DOM element. + */ + header?: TabPanelPassThroughOptionType; + /** + * Uses to pass attributes to the header action's DOM element. + */ + headeraction?: TabPanelPassThroughOptionType; + /** + * Uses to pass attributes to the title's DOM element. + */ + headertitle?: TabPanelPassThroughOptionType; + /** + * Uses to pass attributes to the list's DOM element. + */ + content?: TabPanelPassThroughOptionType; +} + +export interface TabPanelPassThroughAttributes { + [key: string]: any; +} + /** * Defines valid properties in TabPanel component. */ @@ -20,30 +62,37 @@ export interface TabPanelProps { header?: string | undefined; /** * Inline style of the tab header. + * @deprecated since v3.26.0. Use 'pt' property instead. */ headerStyle?: any; /** * Style class of the tab header. + * @deprecated since v3.26.0. Use 'pt' property instead. */ headerClass?: any; /** * Uses to pass all properties of the HTMLLiElement to the tab header. + * @deprecated since v3.26.0. Use 'pt' property instead. */ headerProps?: LiHTMLAttributes | undefined; /** * Uses to pass all properties of the HTMLAnchorElement to the focusable anchor element inside the tab header. + * @deprecated since v3.26.0. Use 'pt' property instead. */ headerActionProps?: AnchorHTMLAttributes | undefined; /** * Inline style of the tab content. + * @deprecated since v3.26.0. Use 'pt' property instead. */ contentStyle?: any; /** * Style class of the tab content. + * @deprecated since v3.26.0. Use 'pt' property instead. */ contentClass?: any; /** * Uses to pass all properties of the HTMLDivElement to the tab content. + * @deprecated since v3.26.0. Use 'pt' property instead. */ contentProps?: HTMLAttributes | undefined; /** @@ -51,6 +100,11 @@ export interface TabPanelProps { * @defaultValue false */ disabled?: boolean | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {TabPanelPassThroughOptions} + */ + pt?: TabPanelPassThroughOptions; } /** * Defines valid slots in TabPanel slots. diff --git a/components/lib/tabpanel/TabPanel.vue b/components/lib/tabpanel/TabPanel.vue index eb75d5be1..ad3efb657 100755 --- a/components/lib/tabpanel/TabPanel.vue +++ b/components/lib/tabpanel/TabPanel.vue @@ -3,8 +3,10 @@