Skip to content

Commit 0d3fc7d

Browse files
committed
refactor(stepper): add requested changes and fix circular dependency
1 parent 53005b4 commit 0d3fc7d

File tree

7 files changed

+24
-31
lines changed

7 files changed

+24
-31
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export * from './stepper.component';
22
export * from './step/step.component';
3-
export * from './common';
3+
export * from './stepper.common';

projects/igniteui-angular/src/lib/stepper/step/step.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ import {
44
ChangeDetectorRef, Component, ContentChild, ElementRef,
55
EventEmitter, forwardRef, HostBinding, HostListener, Inject, Input, OnDestroy, Output, Renderer2, TemplateRef, ViewChild
66
} from '@angular/core';
7-
import { IgxStep } from 'igniteui-angular';
87
import { takeUntil } from 'rxjs/operators';
98
import { CarouselAnimationType, Direction, IgxSlideComponentBase } from '../../carousel/carousel-base';
109
import { PlatformUtil } from '../../core/utils';
1110
import { ToggleAnimationPlayer, ToggleAnimationSettings } from '../../expansion-panel/toggle-animation-component';
1211
import { IgxDirectionality } from '../../services/direction/directionality';
13-
import { IgxStepper, IgxStepperOrienatation, IgxStepType, IGX_STEPPER_COMPONENT, IGX_STEP_COMPONENT } from '../common';
12+
import { IgxStep, IgxStepper, IgxStepperOrienatation, IgxStepType, IGX_STEPPER_COMPONENT, IGX_STEP_COMPONENT } from '../stepper.common';
1413
import { IgxStepContentDirective, IgxStepIndicatorDirective } from '../stepper.directive';
1514
import { IgxStepperService } from '../stepper.service';
1615

projects/igniteui-angular/src/lib/stepper/stepper.component.ts

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { IgxCarouselComponentBase } from '../carousel/carousel-base';
1313
import { IgxRippleModule } from '../directives/ripple/ripple.directive';
1414
import { ToggleAnimationSettings } from '../expansion-panel/toggle-animation-component';
1515
import {
16-
IgxStepperTitlePosition, IgxStepperOrienatation,
16+
IgxStepper, IgxStepperTitlePosition, IgxStepperOrienatation,
1717
IgxStepType, IGX_STEPPER_COMPONENT, IStepChangedEventArgs, IStepChangingEventArgs, IgxStepperVerticalAnimationType
18-
} from './common';
18+
} from './stepper.common';
1919
import {
2020
IgxStepActiveIndicatorDirective,
2121
IgxStepCompletedIndicatorDirective,
@@ -25,7 +25,6 @@ import {
2525
} from './stepper.directive';
2626
import { IgxStepComponent } from './step/step.component';
2727
import { IgxStepperService } from './stepper.service';
28-
import { IgxStepper } from 'igniteui-angular';
2928

3029

3130
// TODO: common interface between IgxCarouselComponentBase and ToggleAnimationPlayer?
@@ -397,7 +396,7 @@ export class IgxStepperComponent extends IgxCarouselComponentBase implements Igx
397396
}
398397

399398
/**
400-
* Activates the step by given index.
399+
* Activates the step at a given index.
401400
*
402401
*```typescript
403402
* this.stepper.navigateTo(1);
@@ -451,8 +450,8 @@ export class IgxStepperComponent extends IgxCarouselComponentBase implements Igx
451450
/**
452451
* Resets the stepper to its initial state i.e. activates the first step.
453452
*
454-
* @remark
455-
* The developer should reset the steps content manually.
453+
* @remarks
454+
* The steps' content will not be automatically reset.
456455
*```typescript
457456
* this.stepper.reset();
458457
*```
@@ -482,21 +481,20 @@ export class IgxStepperComponent extends IgxCarouselComponentBase implements Igx
482481
private updateVerticalAnimationSettings(
483482
openAnimation: AnimationReferenceMetadata,
484483
closeAnimation: AnimationReferenceMetadata): ToggleAnimationSettings {
484+
const customCloseAnimation = useAnimation(closeAnimation, {
485+
params: {
486+
duration: this.animationDuration + 'ms'
487+
}
488+
});
489+
const customOpenAnimation = useAnimation(openAnimation, {
490+
params: {
491+
duration: this.animationDuration + 'ms'
492+
}
493+
});
494+
485495
return {
486-
openAnimation: openAnimation
487-
? useAnimation(openAnimation, {
488-
params: {
489-
duration: this.animationDuration + 'ms'
490-
}
491-
})
492-
: null,
493-
closeAnimation: closeAnimation
494-
? useAnimation(closeAnimation, {
495-
params: {
496-
duration: this.animationDuration + 'ms'
497-
}
498-
})
499-
: null
496+
openAnimation: openAnimation ? customOpenAnimation : null,
497+
closeAnimation: closeAnimation ? customCloseAnimation : null
500498
};
501499
}
502500

projects/igniteui-angular/src/lib/stepper/stepper.directive.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Directive, ElementRef, HostBinding, Inject, Input } from '@angular/core';
2-
import { IGX_STEP_COMPONENT } from './common';
2+
import { IGX_STEP_COMPONENT } from './stepper.common';
33
import { IgxStepComponent } from './step/step.component';
44
import { IgxStepperService } from './stepper.service';
55

@@ -27,20 +27,16 @@ export class IgxStepIndicatorDirective { }
2727
selector: '[igxStepTitle]'
2828
})
2929
export class IgxStepTitleDirective {
30-
3130
@HostBinding('class.igx-stepper__step-title')
3231
public defaultClass = true;
33-
3432
}
3533

3634
@Directive({
3735
selector: '[igxStepSubTitle]'
3836
})
3937
export class IgxStepSubTitleDirective {
40-
4138
@HostBinding('class.igx-stepper__step-subtitle')
4239
public defaultClass = true;
43-
4440
}
4541

4642
@Directive({

projects/igniteui-angular/src/lib/stepper/stepper.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable } from '@angular/core';
2-
import { IgxStepComponent } from 'igniteui-angular';
3-
import { IgxStepper, IgxStepperOrienatation, IStepChangingEventArgs } from './common';
2+
import { IgxStepper, IgxStepperOrienatation, IStepChangingEventArgs } from './stepper.common';
3+
import { IgxStepComponent } from './step/step.component';
44

55
/** @hidden @internal */
66
@Injectable()

src/app/stepper/stepper.sample.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AfterViewInit, ChangeDetectorRef, Component, ViewChild } from '@angular/core';
22
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
3-
import { IgxStepperTitlePosition, IgxStepperOrienatation, IgxStepType } from 'projects/igniteui-angular/src/lib/stepper/common';
3+
import { IgxStepperTitlePosition, IgxStepperOrienatation, IgxStepType } from 'projects/igniteui-angular/src/lib/stepper/stepper.common';
44
import { IgxStepperComponent } from 'projects/igniteui-angular/src/lib/stepper/stepper.component';
55

66
@Component({

0 commit comments

Comments
 (0)