From 73327316aa48b2d83b26c615227a26f4a844fd88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bahad=C4=B1r=20Sofuo=C4=9Flu?= Date: Sat, 6 May 2023 22:56:50 +0300 Subject: [PATCH] Refactor #3922 - For SelectButton --- components/lib/config/PrimeVue.d.ts | 2 + components/lib/selectbutton/SelectButton.d.ts | 51 ++++++++++++++++ components/lib/selectbutton/SelectButton.vue | 7 ++- doc/selectbutton/pt/PTDoc.vue | 59 +++++++++++++++++++ doc/selectbutton/pt/PTImage.vue | 8 +++ doc/selectbutton/pt/index.vue | 41 +++++++++++++ pages/selectbutton/index.vue | 7 ++- 7 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 doc/selectbutton/pt/PTDoc.vue create mode 100644 doc/selectbutton/pt/PTImage.vue create mode 100644 doc/selectbutton/pt/index.vue diff --git a/components/lib/config/PrimeVue.d.ts b/components/lib/config/PrimeVue.d.ts index 4a6663e3d..bb81dacfa 100644 --- a/components/lib/config/PrimeVue.d.ts +++ b/components/lib/config/PrimeVue.d.ts @@ -51,6 +51,7 @@ import { ScrollTopPassThroughOptions } from '../scrolltop'; import { SidebarPassThroughOptions } from '../sidebar'; import { SkeletonPassThroughOptions } from '../skeleton'; import { SpeedDialPassThroughOptions } from '../speeddial'; +import { SelectButtonPassThroughOptions } from '../selectbutton'; import { SplitButtonPassThroughOptions } from '../splitbutton'; import { SplitterPassThroughOptions } from '../splitter'; import { TabMenuPassThroughOptions } from '../tabmenu'; @@ -133,6 +134,7 @@ interface PrimeVuePTOptions { sidebar?: SidebarPassThroughOptions; skeleton?: SkeletonPassThroughOptions; speeddial?: SpeedDialPassThroughOptions; + selectbutton?: SelectButtonPassThroughOptions; splitbutton?: SplitButtonPassThroughOptions; splitter?: SplitterPassThroughOptions; steps?: PanelMenuPassThroughOptions; diff --git a/components/lib/selectbutton/SelectButton.d.ts b/components/lib/selectbutton/SelectButton.d.ts index 4b23a0a36..d4801bde2 100755 --- a/components/lib/selectbutton/SelectButton.d.ts +++ b/components/lib/selectbutton/SelectButton.d.ts @@ -10,6 +10,42 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type SelectButtonPassThroughOptionType = SelectButtonPassThroughAttributes | ((options: SelectButtonPassThroughMethodOptions) => SelectButtonPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface SelectButtonPassThroughMethodOptions { + props: SelectButtonProps; + state: SelectButtonState; +} + +/** + * Custom passthrough(pt) options. + * @see {@link SelectButtonProps.pt} + */ +export interface SelectButtonPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: SelectButtonPassThroughOptionType; + /** + * Uses to pass attributes to the button's DOM element. + */ + button?: SelectButtonPassThroughOptionType; + /** + * Uses to pass attributes to the label's DOM element. + */ + label?: SelectButtonPassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface SelectButtonPassThroughAttributes { + [key: string]: any; +} + /** * Custom change event. * @see {@link SelectButtonEmits.change} @@ -25,6 +61,16 @@ export interface SelectButtonChangeEvent { value: any; } +/** + * Defines current inline state in SelectButton component. + */ +export interface SelectButtonState { + /** + * FocusedIndex state as a number. + */ + focusedIndex: number; +} + /** * Defines valid properties in SelectButton component. */ @@ -72,6 +118,11 @@ export interface SelectButtonProps { * Identifier of the underlying element. */ 'aria-labelledby'?: string | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {SelectButtonPassThroughOptions} + */ + pt?: SelectButtonPassThroughOptions; } /** diff --git a/components/lib/selectbutton/SelectButton.vue b/components/lib/selectbutton/SelectButton.vue index 0a27e2560..0d42ca6a2 100755 --- a/components/lib/selectbutton/SelectButton.vue +++ b/components/lib/selectbutton/SelectButton.vue @@ -1,5 +1,5 @@ diff --git a/doc/selectbutton/pt/PTImage.vue b/doc/selectbutton/pt/PTImage.vue new file mode 100644 index 000000000..9ac50d6b4 --- /dev/null +++ b/doc/selectbutton/pt/PTImage.vue @@ -0,0 +1,8 @@ + diff --git a/doc/selectbutton/pt/index.vue b/doc/selectbutton/pt/index.vue new file mode 100644 index 000000000..c52069d25 --- /dev/null +++ b/doc/selectbutton/pt/index.vue @@ -0,0 +1,41 @@ + + + diff --git a/pages/selectbutton/index.vue b/pages/selectbutton/index.vue index b7b86a41d..0cc830923 100755 --- a/pages/selectbutton/index.vue +++ b/pages/selectbutton/index.vue @@ -1,5 +1,5 @@