Skip to content

Commit d608f70

Browse files
authored
Merge pull request #10061 from IgniteUI/thristodorova/stepper-implementaton
IgxStepperComponent implementaton
2 parents 45cd818 + e80d7af commit d608f70

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+5298
-22
lines changed

Diff for: CHANGELOG.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ All notable changes for each version of this project will be documented in this
55
## 13.0.0
66

77
### New Features
8+
- Added `IgxStepper` component
9+
- Highly customizable component that visualizes content as a process and shows its progress by dividing the content into chronological `igx-steps`.
10+
- Exposed API to control features like step validation, styling, orientation, and easy-to-use keyboard navigation.
11+
- Code example below:
12+
13+
```html
14+
<igx-stepper>
15+
<igx-step *ngFor="let step of stepsData" >
16+
...
17+
</igx-step>
18+
</igx-stepper>
19+
```
20+
21+
- For more information, check out the [README](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/stepper/README.md), [specification](https://github.com/IgniteUI/igniteui-angular/wiki/Stepper-Specification) and [official documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/stepper).
22+
823
- `IgxCsvExporterService`, `IgxExcelExporterService`
924
- Exporter services are no longer required to be provided in the application since they are now injected on a root level.
1025
- `IgxGridToolbarPinningComponent`, `IgxGridToolbarHidingComponent`
@@ -34,7 +49,9 @@ All notable changes for each version of this project will be documented in this
3449
Use `IgxGridToolbarComponent`, `IgxGridToolbarHidingComponent`, `IgxGridToolbarPinningComponent` instead.
3550
- `IgxColumnActionsComponent`
3651
- **Breaking Change** - The following input has been removed
37-
- Input `columns`. Use `igxGrid` `columns` input instead.
52+
- Input `columns`. Use `igxGrid` `columns` input instead.
53+
- `IgxCarousel`
54+
- **Breaking Changes** -The carousel animation type `CarouselAnimationType` is renamed to `HorizontalAnimationType`.
3855

3956
## 12.2.3
4057

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Some of the Angular chart types included are: [Polar chart](https://www.infragis
6565
|select|:white_check_mark:|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/select/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/select)|||||
6666
|slider|:white_check_mark:|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/slider/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/slider/slider)|||||
6767
|snackbar|:white_check_mark:|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/snackbar/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/snackbar)|||||
68+
|stepper|:white_check_mark:|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/stepper/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/stepper)|
6869
|switch|:white_check_mark:|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/switch/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/switch)|||||
6970
|tabs|:white_check_mark:|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/tabs/tabs/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/tabs)|||||
7071
|time picker|:white_check_mark:|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/time-picker/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/time-picker)|||||

Diff for: projects/igniteui-angular/migrations/migration-collection.json

+5
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@
105105
"version": "12.1.0",
106106
"description": "Updates Ignite UI for Angular from v11.1.x to v12.1.0",
107107
"factory": "./update-12_1_0"
108+
},
109+
"migration-22": {
110+
"version": "13.0.0",
111+
"description": "Updates Ignite UI for Angular from v12.2.x to v13.0.0",
112+
"factory": "./update-13_0_0"
108113
}
109114
}
110115
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "../../common/schema/class.schema.json",
3+
"changes": [{
4+
"name": "CarouselAnimationType",
5+
"replaceWith": "HorizontalAnimationType"
6+
}
7+
]
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import * as path from 'path';
2+
3+
import { EmptyTree } from '@angular-devkit/schematics';
4+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
5+
6+
const version = '13.0.0';
7+
8+
describe(`Update to ${version}`, () => {
9+
let appTree: UnitTestTree;
10+
const schematicRunner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json'));
11+
const configJson = {
12+
defaultProject: 'testProj',
13+
projects: {
14+
testProj: {
15+
sourceRoot: '/testSrc'
16+
}
17+
},
18+
schematics: {
19+
'@schematics/angular:component': {
20+
prefix: 'appPrefix'
21+
}
22+
}
23+
};
24+
25+
const migrationName = 'migration-22';
26+
27+
beforeEach(() => {
28+
appTree = new UnitTestTree(new EmptyTree());
29+
appTree.create('/angular.json', JSON.stringify(configJson));
30+
});
31+
32+
it('should rename CarouselAnimationType to HorizontalAnimationType', async () => {
33+
appTree.create(
34+
'/testSrc/appPrefix/component/test.component.ts',
35+
`import { Component, ViewChild } from '@angular/core';
36+
import { CarouselAnimationType } from 'igniteui-angular';
37+
38+
@Component({
39+
selector: 'animationType',
40+
templateUrl: './test.component.html',
41+
styleUrls: ['./test.component.scss']
42+
})
43+
export class AnimationType {
44+
public animationType: CarouselAnimationType = CarouselAnimationType.slide;
45+
}
46+
`);
47+
const tree = await schematicRunner
48+
.runSchematicAsync(migrationName, {}, appTree)
49+
.toPromise();
50+
51+
const expectedContent = `import { Component, ViewChild } from '@angular/core';
52+
import { HorizontalAnimationType } from 'igniteui-angular';
53+
54+
@Component({
55+
selector: 'animationType',
56+
templateUrl: './test.component.html',
57+
styleUrls: ['./test.component.scss']
58+
})
59+
export class AnimationType {
60+
public animationType: HorizontalAnimationType = HorizontalAnimationType.slide;
61+
}
62+
`;
63+
64+
expect(
65+
tree.readContent(
66+
'/testSrc/appPrefix/component/test.component.ts'
67+
)
68+
).toEqual(expectedContent);
69+
});
70+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
2+
import { UpdateChanges } from '../common/UpdateChanges';
3+
4+
const version = '13.0.0';
5+
6+
export default (): Rule => (host: Tree, context: SchematicContext) => {
7+
context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`);
8+
9+
const update = new UpdateChanges(__dirname, host, context);
10+
update.applyChanges();
11+
};

Diff for: projects/igniteui-angular/src/lib/carousel/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ A walkthrough of how to get started can be found [here](https://www.infragistics
1717
| `gesturesSupport` | boolean | Controls should the gestures should be supported. Defaults to `true`. |
1818
| `maximumIndicatorsCount` | number | The number of visible indicators. Defaults to `5`. |
1919
| `indicatorsOrientation` | CarouselIndicatorsOrientation | Controls whether the indicators should be previewed on top or on bottom of carousel. Defaults to `bottom`. |
20-
| `animationType` | CarouselAnimationType | Controls what animation should be played when slides are changing. Defaults to `slide`. |
20+
| `animationType` | HorizontalAnimationType | Controls what animation should be played when slides are changing. Defaults to `slide`. |
2121
| `total` | number | The number of slides the carousel currently has. |
2222
| `current` | number | The index of the slide currently showing. |
2323
| `isPlaying` | boolean | Returns whether the carousel is paused/playing. |

Diff for: projects/igniteui-angular/src/lib/carousel/carousel-base.ts

+18-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import { AnimationBuilder, AnimationPlayer, AnimationReferenceMetadata, useAnimation } from '@angular/animations';
2+
import { EventEmitter } from '@angular/core';
23
import { fadeIn } from '../animations/fade';
34
import { slideInLeft } from '../animations/slide';
45
import { mkenum } from '../core/utils';
56

67
export enum Direction { NONE, NEXT, PREV }
78

8-
export const CarouselAnimationType = mkenum({
9+
export const HorizontalAnimationType = mkenum({
910
none: 'none',
1011
slide: 'slide',
1112
fade: 'fade'
1213
});
13-
export type CarouselAnimationType = (typeof CarouselAnimationType)[keyof typeof CarouselAnimationType];
14+
export type HorizontalAnimationType = (typeof HorizontalAnimationType)[keyof typeof HorizontalAnimationType];
1415

1516
export interface CarouselAnimationSettings {
1617
enterAnimation: AnimationReferenceMetadata;
@@ -26,7 +27,12 @@ export interface IgxSlideComponentBase {
2627
/** @hidden */
2728
export abstract class IgxCarouselComponentBase {
2829
/** @hidden */
29-
public animationType = CarouselAnimationType.slide;
30+
public animationType: HorizontalAnimationType = HorizontalAnimationType.slide;
31+
32+
/** @hidden @internal */
33+
public enterAnimationDone = new EventEmitter();
34+
/** @hidden @internal */
35+
public leaveAnimationDone = new EventEmitter();
3036

3137
/** @hidden */
3238
protected currentItem: IgxSlideComponentBase;
@@ -37,7 +43,7 @@ export abstract class IgxCarouselComponentBase {
3743
/** @hidden */
3844
protected leaveAnimationPlayer?: AnimationPlayer;
3945
/** @hidden */
40-
protected animationDuration = 320;
46+
protected defaultAnimationDuration = 320;
4147
/** @hidden */
4248
protected animationPosition = 0;
4349
/** @hidden */
@@ -48,7 +54,7 @@ export abstract class IgxCarouselComponentBase {
4854

4955
/** @hidden */
5056
protected triggerAnimations() {
51-
if (this.animationType !== CarouselAnimationType.none) {
57+
if (this.animationType !== HorizontalAnimationType.none) {
5258
if (this.animationStarted(this.leaveAnimationPlayer) || this.animationStarted(this.enterAnimationPlayer)) {
5359
requestAnimationFrame(() => {
5460
this.resetAnimations();
@@ -74,10 +80,12 @@ export abstract class IgxCarouselComponentBase {
7480
private resetAnimations() {
7581
if (this.animationStarted(this.leaveAnimationPlayer)) {
7682
this.leaveAnimationPlayer.reset();
83+
this.leaveAnimationDone.emit();
7784
}
7885

7986
if (this.animationStarted(this.enterAnimationPlayer)) {
8087
this.enterAnimationPlayer.reset();
88+
this.enterAnimationDone.emit();
8189
}
8290
}
8391

@@ -86,11 +94,11 @@ export abstract class IgxCarouselComponentBase {
8694
if (this.newDuration) {
8795
duration = this.animationPosition ? this.animationPosition * this.newDuration : this.newDuration;
8896
} else {
89-
duration = this.animationPosition ? this.animationPosition * this.animationDuration : this.animationDuration;
97+
duration = this.animationPosition ? this.animationPosition * this.defaultAnimationDuration : this.defaultAnimationDuration;
9098
}
9199

92100
switch (this.animationType) {
93-
case CarouselAnimationType.slide:
101+
case HorizontalAnimationType.slide:
94102
const trans = this.animationPosition ? this.animationPosition * 100 : 100;
95103
return {
96104
enterAnimation: useAnimation(slideInLeft,
@@ -116,7 +124,7 @@ export abstract class IgxCarouselComponentBase {
116124
}
117125
})
118126
};
119-
case CarouselAnimationType.fade:
127+
case HorizontalAnimationType.fade:
120128
return {
121129
enterAnimation: useAnimation(fadeIn,
122130
{ params: { duration: `${duration}ms`, startOpacity: `${this.animationPosition}` } }),
@@ -146,6 +154,7 @@ export abstract class IgxCarouselComponentBase {
146154
this.animationPosition = 0;
147155
this.newDuration = 0;
148156
this.previousItem.previous = false;
157+
this.enterAnimationDone.emit();
149158
});
150159
this.previousItem.previous = true;
151160
this.enterAnimationPlayer.play();
@@ -167,6 +176,7 @@ export abstract class IgxCarouselComponentBase {
167176
}
168177
this.animationPosition = 0;
169178
this.newDuration = 0;
179+
this.leaveAnimationDone.emit();
170180
});
171181
this.leaveAnimationPlayer.play();
172182
}

Diff for: projects/igniteui-angular/src/lib/carousel/carousel.component.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { UIInteractions, wait } from '../test-utils/ui-interactions.spec';
1111
import { configureTestSuite } from '../test-utils/configure-suite';
1212
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
1313
import { IgxSlideComponent } from './slide.component';
14-
import { CarouselAnimationType } from './carousel-base';
14+
import { HorizontalAnimationType } from './carousel-base';
1515

1616
describe('Carousel', () => {
1717
configureTestSuite();
@@ -589,7 +589,7 @@ describe('Carousel', () => {
589589
await wait();
590590
expect(carousel.get(0).active).toBeTruthy();
591591
expect(carousel.get(0).nativeElement.classList.contains(HelperTestFunctions.ACTIVE_SLIDE_CLASS)).toBeTruthy();
592-
expect(carousel.animationType).toBe(CarouselAnimationType.slide);
592+
expect(carousel.animationType).toBe(HorizontalAnimationType.slide);
593593
carousel.next();
594594
fixture.detectChanges();
595595
await wait(200);
@@ -616,12 +616,12 @@ describe('Carousel', () => {
616616

617617
it('Test fade animation', async () => {
618618
await wait();
619-
carousel.animationType = CarouselAnimationType.fade;
619+
carousel.animationType = HorizontalAnimationType.fade;
620620
fixture.detectChanges();
621621

622622
expect(carousel.get(0).active).toBeTruthy();
623623
expect(carousel.get(0).nativeElement.classList.contains(HelperTestFunctions.ACTIVE_SLIDE_CLASS)).toBeTruthy();
624-
expect(carousel.animationType).toBe(CarouselAnimationType.fade);
624+
expect(carousel.animationType).toBe(HorizontalAnimationType.fade);
625625
carousel.next();
626626
fixture.detectChanges();
627627
await wait(200);

Diff for: projects/igniteui-angular/src/lib/carousel/carousel.component.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { IgxSlideComponent } from './slide.component';
3030
import { ICarouselResourceStrings } from '../core/i18n/carousel-resources';
3131
import { CurrentResourceStrings } from '../core/i18n/resources';
3232
import { HammerGestureConfig, HAMMER_GESTURE_CONFIG } from '@angular/platform-browser';
33-
import { CarouselAnimationType, Direction, IgxCarouselComponentBase } from './carousel-base';
33+
import { HorizontalAnimationType, Direction, IgxCarouselComponentBase } from './carousel-base';
3434

3535
let NEXT_ID = 0;
3636

@@ -227,7 +227,7 @@ export class IgxCarouselComponent extends IgxCarouselComponentBase implements On
227227
*
228228
* @memberOf IgxSlideComponent
229229
*/
230-
@Input() public animationType = CarouselAnimationType.slide;
230+
@Input() public animationType: HorizontalAnimationType = HorizontalAnimationType.slide;
231231

232232
/**
233233
* The custom template, if any, that should be used when rendering carousel indicators
@@ -647,18 +647,18 @@ export class IgxCarouselComponent extends IgxCarouselComponentBase implements On
647647
this.incomingSlide.direction = event.deltaX < 0 ? Direction.NEXT : Direction.PREV;
648648
this.incomingSlide.previous = false;
649649

650-
this.animationPosition = this.animationType === CarouselAnimationType.fade ?
650+
this.animationPosition = this.animationType === HorizontalAnimationType.fade ?
651651
deltaX / slideWidth : (slideWidth - deltaX) / slideWidth;
652652

653653
if (velocity > 1) {
654-
this.newDuration = this.animationDuration / velocity;
654+
this.newDuration = this.defaultAnimationDuration / velocity;
655655
}
656656
this.incomingSlide.active = true;
657657
} else {
658658
this.currentItem.direction = event.deltaX > 0 ? Direction.NEXT : Direction.PREV;
659659
this.previousItem = this.incomingSlide;
660660
this.previousItem.previous = true;
661-
this.animationPosition = this.animationType === CarouselAnimationType.fade ?
661+
this.animationPosition = this.animationType === HorizontalAnimationType.fade ?
662662
Math.abs((slideWidth - deltaX) / slideWidth) : deltaX / slideWidth;
663663
this.playAnimations();
664664
}
@@ -912,7 +912,7 @@ export class IgxCarouselComponent extends IgxCarouselComponentBase implements On
912912
}
913913
this.incomingSlide.previous = true;
914914

915-
if (this.animationType === CarouselAnimationType.fade) {
915+
if (this.animationType === HorizontalAnimationType.fade) {
916916
this.currentItem.nativeElement.style.opacity = `${Math.abs(offset) / slideWidth}`;
917917
} else {
918918
this.currentItem.nativeElement.style.transform = `translateX(${deltaX}px)`;

0 commit comments

Comments
 (0)