From fb7fe4601cbc2fa171a419ec539046a8e5a50ca6 Mon Sep 17 00:00:00 2001 From: agonzalez97 Date: Tue, 5 Apr 2022 14:07:48 +0200 Subject: [PATCH] Adding type file to wizard --- .../dxc-wizard-step.component.ts | 3 ++- .../dxc-wizard-step/dxc-wizard-step.types.ts | 7 ++++++ .../lib/dxc-wizard/dxc-wizard.component.ts | 21 ++++-------------- .../src/lib/dxc-wizard/dxc-wizard.types.ts | 22 +++++++++++++++++++ 4 files changed, 35 insertions(+), 18 deletions(-) create mode 100644 projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard-step/dxc-wizard-step.types.ts create mode 100644 projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard.types.ts diff --git a/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard-step/dxc-wizard-step.component.ts b/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard-step/dxc-wizard-step.component.ts index 083b9187a..33e458755 100644 --- a/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard-step/dxc-wizard-step.component.ts +++ b/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard-step/dxc-wizard-step.component.ts @@ -15,6 +15,7 @@ import { css } from "emotion"; import { BehaviorSubject } from "rxjs"; import { DxcWizardIconComponent } from "../dxc-wizard-icon/dxc-wizard-icon.component"; import { WizardService } from "../services/wizard.service"; +import { WizardStepProperties } from "./dxc-wizard-step.types"; @Component({ selector: "dxc-wizard-step", @@ -70,7 +71,7 @@ export class DxcWizardStepComponent { @HostBinding("class") className; - defaultInputs = new BehaviorSubject({ + defaultInputs = new BehaviorSubject({ label: null, description: null, disabled: false, diff --git a/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard-step/dxc-wizard-step.types.ts b/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard-step/dxc-wizard-step.types.ts new file mode 100644 index 000000000..1dbabfb98 --- /dev/null +++ b/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard-step/dxc-wizard-step.types.ts @@ -0,0 +1,7 @@ +export interface WizardStepProperties { + label: string; + description?: string; + disabled?: boolean; + valid?: boolean; + mode?: string; +} diff --git a/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard.component.ts b/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard.component.ts index 1a036553d..03c99fd54 100644 --- a/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard.component.ts +++ b/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard.component.ts @@ -15,21 +15,7 @@ import { DxcWizardStepComponent } from "./dxc-wizard-step/dxc-wizard-step.compon import { WizardService } from "./services/wizard.service"; import { ChangeDetectorRef } from "@angular/core"; import { coerceNumberProperty } from "@angular/cdk/coercion"; - -type Space = - | "xxsmall" - | "xsmall" - | "small" - | "medium" - | "large" - | "xlarge" - | "xxlarge"; -type Margin = { - top?: Space; - bottom?: Space; - left?: Space; - right?: Space; -}; +import { Spacing, Space, WizardProperties } from "./dxc-wizard.types"; @Component({ selector: "dxc-wizard", @@ -49,7 +35,7 @@ export class DxcWizardComponent { * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge'). * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes. */ - @Input() margin: Margin | Space; + @Input() margin: Spacing | Space; /** * Value of the tabindex attribute that is given to all the steps. */ @@ -72,10 +58,11 @@ export class DxcWizardComponent { @HostBinding("class") className; - defaultInputs = new BehaviorSubject({ + defaultInputs = new BehaviorSubject({ mode: "horizontal", currentStep: 0, margin: null, + tabIndexValue: 0, }); constructor( diff --git a/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard.types.ts b/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard.types.ts new file mode 100644 index 000000000..327ae322f --- /dev/null +++ b/projects/dxc-ngx-cdk/src/lib/dxc-wizard/dxc-wizard.types.ts @@ -0,0 +1,22 @@ +export interface WizardProperties { + mode?: string; + currentStep?: number; + margin?: Spacing | Space; + tabIndexValue?: number; +} + +export type Space = + | "xxsmall" + | "xsmall" + | "small" + | "medium" + | "large" + | "xlarge" + | "xxlarge"; + +export type Spacing = { + top?: Space; + bottom?: Space; + left?: Space; + right?: Space; +};