From 5d40f1c45d516603dc20eebab59823f0b3d8e716 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: Wed, 26 Apr 2023 12:58:46 +0300 Subject: [PATCH] Refactor #3907 - For Steps --- api-generator/components/steps.js | 6 ++++ components/lib/steps/Steps.d.ts | 52 +++++++++++++++++++++++++++++++ components/lib/steps/Steps.vue | 19 ++++++----- 3 files changed, 69 insertions(+), 8 deletions(-) diff --git a/api-generator/components/steps.js b/api-generator/components/steps.js index c0e3b3111..00dec500f 100644 --- a/api-generator/components/steps.js +++ b/api-generator/components/steps.js @@ -22,6 +22,12 @@ const StepsProps = [ type: 'boolean', default: 'true', description: "Whether to apply 'router-link-active-exact' class if route exactly matches the item path." + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/components/lib/steps/Steps.d.ts b/components/lib/steps/Steps.d.ts index caab37843..4695b1d9b 100755 --- a/components/lib/steps/Steps.d.ts +++ b/components/lib/steps/Steps.d.ts @@ -11,6 +11,53 @@ import { VNode } from 'vue'; import { MenuItem } from '../menuitem'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type StepsPassThroughOptionType = StepsPassThroughAttributes | ((options: StepsPassThroughMethodOptions) => StepsPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface StepsPassThroughMethodOptions { + props: StepsProps; +} + +/** + * Custom passthrough(pt) options. + * @see {@link StepsProps.pt} + */ +export interface StepsPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: StepsPassThroughOptionType; + /** + * Uses to pass attributes to the list's DOM element. + */ + menu?: StepsPassThroughOptionType; + /** + * Uses to pass attributes to the list item's DOM element. + */ + menuitem?: StepsPassThroughOptionType; + /** + * Uses to pass attributes to the action's DOM element. + */ + action?: StepsPassThroughOptionType; + /** + * Uses to pass attributes to the step's DOM element. + */ + step?: StepsPassThroughOptionType; + /** + * Uses to pass attributes to the label's DOM element. + */ + label?: StepsPassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface StepsPassThroughAttributes { + [key: string]: any; +} + /** * Defines valid properties in Steps component. */ @@ -33,6 +80,11 @@ export interface StepsProps { * @defaultValue true */ exact?: boolean | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {StepsPassThroughOptions} + */ + pt?: StepsPassThroughOptions; } /** diff --git a/components/lib/steps/Steps.vue b/components/lib/steps/Steps.vue index 294fd21f9..7c1ebf33e 100755 --- a/components/lib/steps/Steps.vue +++ b/components/lib/steps/Steps.vue @@ -1,8 +1,8 @@