From 974a9632182c3ba40f87c253fda1dd7dc2a77cc3 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 Jul 2023 13:57:49 +0300 Subject: [PATCH] Refactor #4196 - For Steps --- components/lib/steps/BaseSteps.vue | 2 +- components/lib/steps/Steps.d.ts | 21 +++++++++++++++++++++ components/lib/steps/Steps.vue | 23 ++++++++++++++++------- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/components/lib/steps/BaseSteps.vue b/components/lib/steps/BaseSteps.vue index a0b03968e..e90d58ebc 100644 --- a/components/lib/steps/BaseSteps.vue +++ b/components/lib/steps/BaseSteps.vue @@ -57,7 +57,7 @@ const styles = ` `; const classes = { - root: ({ instance }) => ['p-steps p-component', { 'p-readonly': instance.readonly }], + root: ({ props }) => ['p-steps p-component', { 'p-readonly': props.readonly }], menu: 'p-steps-list', menuitem: ({ instance, item }) => [ 'p-steps-item', diff --git a/components/lib/steps/Steps.d.ts b/components/lib/steps/Steps.d.ts index 6430cb908..9c5461334 100755 --- a/components/lib/steps/Steps.d.ts +++ b/components/lib/steps/Steps.d.ts @@ -20,6 +20,7 @@ export declare type StepsPassThroughOptionType = StepsPassThroughAttributes | (( export interface StepsPassThroughMethodOptions { instance: any; props: StepsProps; + context: StepsContext; } /** @@ -65,6 +66,26 @@ export interface StepsPassThroughAttributes { [key: string]: any; } +/** + * Defines current options in Steps component. + */ +export interface StepsContext { + /** + * Index of the menuitem. + */ + index: number; + /** + * Current active state of menuitem as a boolean. + * @defaultValue false + */ + active: boolean; + /** + * Current disabled state of menuitem as a boolean. + * @defaultValue false + */ + disabled: boolean; +} + /** * Defines valid properties in Steps component. */ diff --git a/components/lib/steps/Steps.vue b/components/lib/steps/Steps.vue index 14d13e551..fcdac9553 100755 --- a/components/lib/steps/Steps.vue +++ b/components/lib/steps/Steps.vue @@ -2,7 +2,7 @@