|
13 | 13 | {{ $t(stepHeaderText(step.name, step.status)) }} |
14 | 14 | </h5> |
15 | 15 | </div> |
16 | | - <FirstStep |
17 | | - v-if="step.status!=='inactive' && step.name==='FS'" |
18 | | - :step-id="step.id" |
19 | | - :selected="step.selected" |
20 | | - :status="step.status" |
21 | | - @change="changeStepSelected" |
22 | | - /> |
23 | | - <Step |
24 | | - v-else-if="step.status!=='inactive' && isLicenseAttribute(step.name)" |
| 16 | + <ChooserStep |
| 17 | + v-if="step.status!=='inactive' && (isLicenseAttribute(step.name)||step.name==='FS')" |
25 | 18 | :step-id="step.id" |
26 | 19 | :step-name="step.name" |
27 | 20 | :selected="step.selected" |
|
50 | 43 | :step-id="step.id" |
51 | 44 | :status="step.status" |
52 | 45 | /> |
53 | | - <nav |
54 | | - v-if="step.status==='current'" |
55 | | - class="step-navigation" |
56 | | - > |
57 | | - <v-button |
58 | | - v-if="step.name!=='FS'" |
59 | | - class="is-border" |
60 | | - @click="handlePrevious(step.name)" |
61 | | - > |
62 | | - {{ $t('stepper.nav.previous-label') }} |
63 | | - </v-button> |
64 | | - <v-button |
65 | | - v-if="step.name!=='AD'" |
66 | | - :class="['is-success', nextButtonEnabledState(step.id)]" |
67 | | - :disabled="nextButtonEnabledState(step.id) ? 'disabled' : null" |
68 | | - @click="handleNext(step.name)" |
69 | | - > |
70 | | - {{ $t('stepper.nav.next-label') }} |
71 | | - </v-button> |
72 | | - <span |
73 | | - v-else |
74 | | - class="pagination-finish" |
75 | | - >{{ $t('stepper.nav.finish-label') }}</span> |
76 | | - </nav> |
| 46 | + <StepNavigation |
| 47 | + v-if="step.status === 'current'" |
| 48 | + :step-name="step.name" |
| 49 | + :is-next-enabled="isNextEnabled(step.id)" |
| 50 | + @navigate="navigate" |
| 51 | + /> |
77 | 52 | </div> |
78 | 53 | </div> |
79 | 54 | </template> |
80 | 55 |
|
81 | 56 | <script> |
82 | | -import Step from './Step' |
83 | | -import FirstStep from './FirstStep' |
| 57 | +import ChooserStep from './ChooserStep' |
84 | 58 | import AttributionDetailsStep from './AttributionDetailsStep' |
85 | 59 | import CopyrightWaiverStep from './CopyrightWaiverStep' |
86 | 60 | import DropdownStep from './DropdownStep' |
| 61 | +import StepNavigation from './StepNavigation' |
87 | 62 | import { updateVisibleEnabledStatus } from '../utils/license-utilities' |
88 | 63 |
|
89 | 64 | export default { |
90 | 65 | name: 'Stepper', |
91 | 66 | components: { |
92 | | - FirstStep, |
93 | | - Step, |
| 67 | + ChooserStep, |
94 | 68 | AttributionDetailsStep, |
95 | 69 | CopyrightWaiverStep, |
96 | | - DropdownStep |
| 70 | + DropdownStep, |
| 71 | + StepNavigation |
97 | 72 | }, |
98 | 73 | props: { |
99 | 74 | value: { |
@@ -191,12 +166,13 @@ export default { |
191 | 166 | * Checks if the Next button should be disabled. Next button is enabled only |
192 | 167 | * after the user has interacted with the step (selected radio or checked a checkbox) |
193 | 168 | * @param {number} stepId |
194 | | - * @returns {'disabled'|''} next button's disabled status |
| 169 | + * @returns {Boolean} next button's disabled status |
195 | 170 | */ |
196 | | - nextButtonEnabledState(stepId) { |
197 | | - return this.steps[stepId].selected === undefined |
198 | | - ? 'disabled' |
199 | | - : '' |
| 171 | + isNextEnabled(stepId) { |
| 172 | + return this.steps[stepId].selected !== undefined |
| 173 | + }, |
| 174 | + navigate({ direction, stepName }) { |
| 175 | + direction === 'next' ? this.handleNext(stepName) : this.handlePrevious() |
200 | 176 | }, |
201 | 177 | changeStepSelected(stepName, stepId, isSelected) { |
202 | 178 | /** |
@@ -398,17 +374,6 @@ export default { |
398 | 374 | .inactive .step-title { |
399 | 375 | color: #b0b0b0; |
400 | 376 | } |
401 | | - .step-navigation { |
402 | | - margin: 13px 0; |
403 | | - padding-left: 65px; |
404 | | - .button + .button { |
405 | | - margin-left: 1rem; |
406 | | - } |
407 | | - } |
408 | | - .pagination-finish{ |
409 | | - margin-left: 1rem; |
410 | | - line-height: 42px; |
411 | | - } |
412 | 377 | .slide-enter-active { |
413 | 378 | /*transition: all .3s ease;*/ |
414 | 379 | animation: slide-down .3s; |
|
0 commit comments