Skip to content

Commit

Permalink
refactor(VStepperVertical): remove finish functionality, adjust slot …
Browse files Browse the repository at this point in the history
…props
  • Loading branch information
johnleider committed May 10, 2024
1 parent 2276b1e commit 364de3f
Show file tree
Hide file tree
Showing 46 changed files with 21 additions and 97 deletions.
Expand Up @@ -17,7 +17,7 @@ import type { StepperItem, StepperItemSlot } from '@/components/VStepper/VSteppe

export type VStepperVerticalSlots = {
actions: StepperItemSlot
default: VStepperSlot
default: VStepperSlot & { step: unknown }
icon: StepperItemSlot
title: StepperItemSlot
subtitle: StepperItemSlot
Expand Down Expand Up @@ -122,7 +122,7 @@ export const VStepperVertical = genericComponent<VStepperVerticalSlots>()({
</VStepperVerticalItem>
))}

{ slots.default?.({ prev, next }) }
{ slots.default?.({ prev, next, step: model.value }) }
</>
)
},
Expand Down
@@ -1,26 +1,13 @@
// Components
import { VBtn } from '@/components/VBtn/VBtn'
import { makeVStepperActionsProps, VStepperActions } from '@/components/VStepper/VStepperActions'

// Utilities
import { genericComponent, propsFactory, useRender } from '@/util'

export type VStepperActionsSlots = {
prev: {
props: { onClick: () => void }
}
next: {
props: { onClick: () => void }
}
}
// Types
import type { VStepperActionsSlots } from '@/components/VStepper/VStepperActions'

export const makeVStepperVerticalActionsProps = propsFactory({
finishText: {
type: String,
default: '$vuetify.stepper.finish',
},
finish: Boolean,

...makeVStepperActionsProps(),
}, 'VStepperActions')

Expand All @@ -32,7 +19,6 @@ export const VStepperVerticalActions = genericComponent<VStepperActionsSlots>()(
emits: {
'click:prev': () => true,
'click:next': () => true,
'click:finish': () => true,
},

setup (props, { emit, slots }) {
Expand All @@ -41,8 +27,7 @@ export const VStepperVerticalActions = genericComponent<VStepperActionsSlots>()(
}

function onClickNext () {
if (props.finish) emit('click:finish')
else emit('click:next')
emit('click:next')
}

useRender(() => {
Expand All @@ -52,21 +37,10 @@ export const VStepperVerticalActions = genericComponent<VStepperActionsSlots>()(
<VStepperActions
class="v-stepper-vertical-actions"
{ ...stepperActionsProps }
nextText={ props.finish ? props.finishText : undefined }
>
{{
prev: (slotProps: any) => {
return slots.prev?.(slotProps) ?? (
<VBtn { ...slotProps.props } onClick={ onClickPrev } />
)
},
next: (slotProps: any) => {
return slots.next?.(slotProps) ?? (
<VBtn { ...slotProps.props } onClick={ onClickNext } />
)
},
}}
</VStepperActions>
onClick:prev={ onClickPrev }
onClick:next={ onClickNext }
v-slots={ slots }
/>
)
})

Expand Down
31 changes: 12 additions & 19 deletions packages/vuetify/src/labs/VStepperVertical/VStepperVerticalItem.tsx
Expand Up @@ -26,11 +26,8 @@ export type VStepperVerticalItemSlots = {
prev: StepperItemSlot
next: StepperItemSlot
actions: StepperItemSlot & {
props: {
'onClick:finish': () => void
'onClick:next': () => void
'onClick:prev': () => void
}
next: () => void
prev: () => void
}
}

Expand Down Expand Up @@ -89,13 +86,17 @@ export const VStepperVerticalItem = genericComponent<VStepperVerticalItemSlots>(
value: props.value,
}))

function onClickFinish () {
emit('click:finish')
}
const actionProps = computed(() => ({
...slotProps.value,
prev: onClickPrev,
next: onClickNext,
}))

function onClickNext () {
emit('click:next')

if (groupItem.value?.isLast.value) return

groupItem.value.group.next()
}

Expand Down Expand Up @@ -179,21 +180,13 @@ export const VStepperVerticalItem = genericComponent<VStepperVerticalItemSlots>(
},
}}
>
{ slots.actions?.({
...slotProps.value,
props: {
'onClick:finish': onClickFinish,
'onClick:next': onClickNext,
'onClick:prev': onClickPrev,
},
}) ?? (
{ slots.actions?.(actionProps.value) ?? (
<VStepperVerticalActions
onClick:next={ onClickNext }
onClick:prev={ onClickPrev }
onClick:finish={ onClickFinish }
v-slots={{
prev: slots.prev ? (slotProps: any) => slots.prev?.(slotProps) : undefined,
next: slots.next ? (slotProps: any) => slots.next?.(slotProps) : undefined,
prev: slots.prev ? () => slots.prev?.(actionProps.value) : undefined,
next: slots.next ? () => slots.next?.(actionProps.value) : undefined,
}}
/>
)}
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/af.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/ar.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/az.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/bg.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Следващ',
prev: 'Предишен',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/ca.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/ckb.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/cs.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Další',
prev: 'Předchozí',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/da.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/de.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Weiter',
prev: 'Zurück',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/el.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/en.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/es.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/et.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/fa.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'بعدی',
prev: 'قبلی',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/fi.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/fr.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Suivant',
prev: 'Précédent',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/he.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/hr.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/hu.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/id.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/it.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Successivo',
prev: 'Precedente',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/ja.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/km.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'បន្ទាប់',
prev: 'មុន',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/ko.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: '다음',
prev: '이전',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/lt.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Kitas',
prev: 'Ankstesnis',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/lv.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/nl.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Volgende',
prev: 'Vorige',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/no.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Neste',
prev: 'Forrige',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/pl.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Następny',
prev: 'Poprzedni',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/pt.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Próximo',
prev: 'Anterior',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/locale/ro.ts
Expand Up @@ -88,7 +88,6 @@ export default {
stepper: {
next: 'Next',
prev: 'Previous',
finish: 'Finish',
},
rating: {
ariaLabel: {
Expand Down

0 comments on commit 364de3f

Please sign in to comment.