Skip to content

Commit 1d58ed5

Browse files
authored
Merge pull request #674 from dxc-technology/aida-wizard-types
Added wizard types
2 parents d4a31e1 + 2f30da6 commit 1d58ed5

File tree

3 files changed

+56
-11
lines changed

3 files changed

+56
-11
lines changed

projects/dxc-ngx-cdk-site/src/app/components/examples/wizard/properties/wizard-table-properties/wizard-table-properties.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
<tr>
3030
<td>tabIndexValue: number</td>
3131
<td><code>0</code></td>
32-
<td>Value of the tabindex that is given to all the steps.</td>
32+
<td>Value of the tabindex attribute that is given to all the steps.</td>
3333
</tr>
3434
<tr>
3535
<td>onStepClick: EventEmitter</td>
3636
<td></td>
3737
<td>
38-
This function will be called when the user clicks a step. The step number
39-
will be passed as a parameter.
38+
This event will emit in case the user clicks a step. The step number will
39+
be passed as a parameter.
4040
</td>
4141
</tr>
4242
<tr>

projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard-step/dxc-wizard-step.component.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,17 @@ import { WizardService } from "../services/wizard.service";
2121
templateUrl: "./dxc-wizard-step.component.html",
2222
})
2323
export class DxcWizardStepComponent {
24+
/**
25+
* Step label.
26+
*/
2427
@Input() label: string;
28+
/**
29+
* Description that will be placed next to the step.
30+
*/
2531
@Input() description: string;
32+
/**
33+
* Whether the step is disabled or not.
34+
*/
2635
@Input()
2736
get disabled(): boolean {
2837
return this._disabled;
@@ -31,6 +40,9 @@ export class DxcWizardStepComponent {
3140
this._disabled = coerceBooleanProperty(value);
3241
}
3342
private _disabled = false;
43+
/**
44+
* Whether the step is valid or not.
45+
*/
3446
@Input()
3547
get valid(): boolean {
3648
return this._valid;
@@ -228,7 +240,8 @@ export class DxcWizardStepComponent {
228240
.number {
229241
color: var(--wizard-disabledFontColor);
230242
}
231-
.infoContainer .label, .infoContainer .description {
243+
.infoContainer .label,
244+
.infoContainer .description {
232245
color: var(--wizard-disabledFontColor);
233246
}
234247
}

projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard.component.ts

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,58 @@ import { CssUtils } from "../utils";
1414
import { DxcWizardStepComponent } from "./dxc-wizard-step/dxc-wizard-step.component";
1515
import { WizardService } from "./services/wizard.service";
1616
import { ChangeDetectorRef } from "@angular/core";
17-
import { coerceNumberProperty } from '@angular/cdk/coercion';
17+
import { coerceNumberProperty } from "@angular/cdk/coercion";
18+
19+
type Space =
20+
| "xxsmall"
21+
| "xsmall"
22+
| "small"
23+
| "medium"
24+
| "large"
25+
| "xlarge"
26+
| "xxlarge";
27+
type Margin = {
28+
top?: Space;
29+
bottom?: Space;
30+
left?: Space;
31+
right?: Space;
32+
};
1833

1934
@Component({
2035
selector: "dxc-wizard",
2136
templateUrl: "./dxc-wizard.component.html",
2237
providers: [CssUtils, WizardService],
2338
})
2439
export class DxcWizardComponent {
25-
@Input() mode: string = "horizontal";
26-
@Input() currentStep: number;
27-
@Input() margin: any;
40+
/**
41+
* The wizard can be showed in horizontal or vertical.
42+
*/
43+
@Input() mode: "horizontal" | "vertical" = "horizontal";
44+
/**
45+
* Defines which step is marked as the current. The numeration starts in 0.
46+
*/
47+
@Input() currentStep: number = 0;
48+
/**
49+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
50+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
51+
*/
52+
@Input() margin: Margin | Space;
53+
/**
54+
* Value of the tabindex attribute that is given to all the steps.
55+
*/
2856
@Input()
2957
get tabIndexValue(): number {
3058
return this._tabIndexValue;
3159
}
3260
set tabIndexValue(value: number) {
3361
this._tabIndexValue = coerceNumberProperty(value);
3462
}
35-
private _tabIndexValue;
36-
@Output() onStepClick = new EventEmitter<any>();
63+
private _tabIndexValue = 0;
64+
/**
65+
* This event will emit in case the user clicks a step. The step
66+
* number will be passed as a parameter.
67+
*/
68+
@Output() onStepClick: EventEmitter<number> = new EventEmitter<number>();
3769

3870
@ContentChildren(DxcWizardStepComponent)
3971
dxcWizardSteps: QueryList<DxcWizardStepComponent>;
@@ -42,7 +74,7 @@ export class DxcWizardComponent {
4274

4375
defaultInputs = new BehaviorSubject<any>({
4476
mode: "horizontal",
45-
currentStep: null,
77+
currentStep: 0,
4678
margin: null,
4779
});
4880

0 commit comments

Comments
 (0)