Skip to content

Commit 9ae33cb

Browse files
authored
Merge branch 'master' into vmihalkov/fix-6004-master
2 parents 063df28 + 74dbab4 commit 9ae33cb

33 files changed

+2038
-649
lines changed

CHANGELOG.md

+18-8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ All notable changes for each version of this project will be documented in this
1515

1616
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
1717
- **Behavioral Change** - Pinning columns is no longer automatically prevented when the pinning area would exceed the size of the grid.
18+
- `IgxCarousel`:
19+
- **Breaking Changes** -The carousel slides are no longer array, they are changed to QueryList.
20+
- **Behavioural change** - When slides are more than 5, a label is shown instead of the indicators. The count limit of visible indicators can be changed with the input `maximumIndicatorsCount`
21+
1822

1923
### New Features
2024
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`:
@@ -25,13 +29,13 @@ All notable changes for each version of this project will be documented in this
2529
- `sortingExpressionsChange` event emitter is added, which is fired whenever a change to the sorting expressions has occurred (prior to performing the actual sorting).
2630
- `filteringExpressionsTreeChange` event emitter is added, which is fired whenever a change to the filtering expressions has occurred (prior to performing the actual filtering).
2731
- `advancedFilteringExpressionsTreeChange` event emitter is added, which is fired whenever a change to the advanced filtering expressions has occurred (prior to performing the actual filtering).
28-
- `IgxGridExcelStyleFilteringComponent` and `IgxAdvancedFilteringDialogComponent` can now be hosted outside of the grid in order to provide the same experience as the built-in filtering UI.
29-
- `IgxOverlayService`:
30-
- `setOffset` method added. It offsets the content along the corresponding axis by the provided amount.
31-
- `IgxToggleDirective`:
32-
- `setOffset` method added. It offsets the content along the corresponding axis by the provided amount.
33-
- `IgxRowDragGhost` directive is added. It allows providing a custom template for the drag ghost when dragging a row.
34-
```html
32+
- `IgxGridExcelStyleFilteringComponent` and `IgxAdvancedFilteringDialogComponent` can now be hosted outside of the grid in order to provide the same experience as the built-in filtering UI.
33+
- `IgxOverlayService`:
34+
- `setOffset` method added. It offsets the content along the corresponding axis by the provided amount.
35+
- `IgxToggleDirective`:
36+
- `setOffset` method added. It offsets the content along the corresponding axis by the provided amount.
37+
- `IgxRowDragGhost` directive is added. It allows providing a custom template for the drag ghost when dragging a row.
38+
```html
3539
<igx-grid #grid1 [data]="remote | async" primaryKey="ProductID"
3640
[rowDraggable]="true">
3741
<igx-column field="ProductName"></igx-column>
@@ -43,7 +47,13 @@ All notable changes for each version of this project will be documented in this
4347
</div>
4448
</ng-template>
4549
</igx-grid>
46-
```
50+
```
51+
- `IgxCarousel`:
52+
- `keyboardSupport` input is added, which can be used to enable and disable keyboard navigation
53+
- `maximumIndicatorsCount` input is added, which can be used to set the number of visible indicators
54+
- `indicatorsOrientation` input is added, which can be used to set the position of indicators it can be top or bottom
55+
- `animationType` input is added, which can be used to set animation when changing slides
56+
- `indicatorTemplate` directive is added, which can be used to provide a custom indicator for carousel. If this property is not provided, a default indicator template will be used instead.
4757

4858
## 8.2.6
4959

projects/igniteui-angular/schematics/ng-add/index.spec.ts

+28-26
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ describe('ng-add schematics', () => {
99
const collectionPath = path.join(__dirname, '../collection.json');
1010
const runner: SchematicTestRunner = new SchematicTestRunner('cli-schematics', collectionPath);
1111
let tree: UnitTestTree;
12+
const sourceRoot = 'testSrc';
1213
const ngJsonConfig = {
1314
defaultProject: 'testProj',
1415
projects: {
1516
testProj: {
16-
sourceRoot: 'src',
17+
sourceRoot: sourceRoot,
1718
projectType: ProjectType.Application,
1819
architect: {
1920
serve: {},
2021
build: {
2122
options: {
22-
main: 'src/main.ts',
23+
main: `${sourceRoot}/main.ts`,
24+
polyfills: `${sourceRoot}/polyfills.ts`,
2325
scripts: []
2426
}
2527
}
@@ -42,7 +44,7 @@ describe('ng-add schematics', () => {
4244
tree = new UnitTestTree(new EmptyTree());
4345
tree.create('/angular.json', JSON.stringify(ngJsonConfig));
4446
tree.create('/package.json', JSON.stringify(pkgJsonConfig));
45-
tree.create('src/main.ts', '// test comment');
47+
tree.create(`${sourceRoot}/main.ts`, '// test comment');
4648
});
4749

4850
it('should create the needed files correctly', () => {
@@ -71,7 +73,7 @@ describe('ng-add schematics', () => {
7173

7274
it('should add hammer.js to the main.ts file', () => {
7375
runner.runSchematic('ng-add', { normalizeCss: false }, tree);
74-
const mainTs = tree.read('src/main.ts').toString();
76+
const mainTs = tree.read(`${sourceRoot}/main.ts`).toString();
7577
expect(mainTs).toContain('import \'hammerjs\';');
7678
});
7779

@@ -82,12 +84,12 @@ describe('ng-add schematics', () => {
8284
tree.overwrite('angular.json', JSON.stringify(workspace));
8385
runner.runSchematic('ng-add', { normalizeCss: false }, tree);
8486

85-
const newContent = tree.read('src/main.ts').toString();
87+
const newContent = tree.read(`${sourceRoot}/main.ts`).toString();
8688
expect(newContent.split('import \'hammerjs\';\n// test comment').length).toEqual(1);
8789
});
8890

8991
it('should not add hammer.js if it exists in main.ts', () => {
90-
const mainTsPath = 'src/main.ts';
92+
const mainTsPath = `${sourceRoot}/main.ts`;
9193
const content = tree.read(mainTsPath).toString();
9294
tree.overwrite(mainTsPath, 'import \'hammerjs\';\n' + content);
9395
runner.runSchematic('ng-add', { normalizeCss: false }, tree);
@@ -138,54 +140,54 @@ import 'core-js/es6/set';
138140
import 'web-animations-js'; // Run \`npm install --save web-animations-js\`.
139141
`;
140142

141-
tree.create('src/polyfills.ts', polyfills);
143+
tree.create(`${sourceRoot}/polyfills.ts`, polyfills);
142144
runner.runSchematic('ng-add', { polyfills: true, normalizeCss: false }, tree);
143-
expect(tree.readContent('src/polyfills.ts').replace(/\r\n/g, '\n')).toEqual(result.replace(/\r\n/g, '\n'));
145+
expect(tree.readContent(`${sourceRoot}/polyfills.ts`).replace(/\r\n/g, '\n')).toEqual(result.replace(/\r\n/g, '\n'));
144146
});
145147

146148
it('should properly add css reset', () => {
147-
tree.create('src/styles.scss', '');
149+
tree.create(`${sourceRoot}/styles.scss`, '');
148150
runner.runSchematic('ng-add', { normalizeCss: true }, tree);
149151
let pkgJsonData = JSON.parse(tree.readContent('/package.json'));
150-
expect(tree.readContent('src/styles.scss')).toEqual(scssImport);
152+
expect(tree.readContent(`${sourceRoot}/styles.scss`)).toEqual(scssImport);
151153
expect(pkgJsonData.dependencies['minireset.css']).toBeTruthy();
152154
resetJsonConfigs(tree);
153-
tree.delete('src/styles.scss');
155+
tree.delete(`${sourceRoot}/styles.scss`);
154156

155-
tree.create('src/styles.sass', '');
157+
tree.create(`${sourceRoot}/styles.sass`, '');
156158
runner.runSchematic('ng-add', { normalizeCss: true }, tree);
157159
pkgJsonData = JSON.parse(tree.readContent('/package.json'));
158-
expect(tree.readContent('src/styles.sass')).toEqual(scssImport);
160+
expect(tree.readContent(`${sourceRoot}/styles.sass`)).toEqual(scssImport);
159161
expect(pkgJsonData.dependencies['minireset.css']).toBeTruthy();
160162
resetJsonConfigs(tree);
161-
tree.delete('src/styles.sass');
163+
tree.delete(`${sourceRoot}/styles.sass`);
162164

163-
tree.create('src/styles.css', '');
165+
tree.create(`${sourceRoot}/styles.css`, '');
164166
runner.runSchematic('ng-add', { normalizeCss: true }, tree);
165167
pkgJsonData = JSON.parse(tree.readContent('/package.json'));
166-
expect(tree.readContent('src/styles.css')).toBe('');
168+
expect(tree.readContent(`${sourceRoot}/styles.css`)).toBe('');
167169
expect(pkgJsonData.dependencies['minireset.css']).toBeTruthy();
168170
expect(JSON.parse(tree.readContent('/angular.json')).projects['testProj'].architect.build.options.styles).toContain(cssImport);
169171
resetJsonConfigs(tree);
170-
tree.delete('src/styles.css');
172+
tree.delete(`${sourceRoot}/styles.css`);
171173

172-
tree.create('src/styles.less', '');
174+
tree.create(`${sourceRoot}/styles.less`, '');
173175
runner.runSchematic('ng-add', { normalizeCss: true }, tree);
174176
pkgJsonData = JSON.parse(tree.readContent('/package.json'));
175-
expect(tree.readContent('src/styles.less')).toBe('');
177+
expect(tree.readContent(`${sourceRoot}/styles.less`)).toBe('');
176178
expect(pkgJsonData.dependencies['minireset.css']).toBeTruthy();
177179
expect(JSON.parse(tree.readContent('/angular.json')).projects['testProj'].architect.build.options.styles).toContain(cssImport);
178180
resetJsonConfigs(tree);
179-
tree.delete('src/styles.less');
181+
tree.delete(`${sourceRoot}/styles.less`);
180182

181-
tree.create('src/styles.styl', '');
183+
tree.create(`${sourceRoot}/styles.styl`, '');
182184
runner.runSchematic('ng-add', { normalizeCss: true }, tree);
183185
pkgJsonData = JSON.parse(tree.readContent('/package.json'));
184-
expect(tree.readContent('src/styles.styl')).toBe('');
186+
expect(tree.readContent(`${sourceRoot}/styles.styl`)).toBe('');
185187
expect(pkgJsonData.dependencies['minireset.css']).toBeTruthy();
186188
expect(JSON.parse(tree.readContent('/angular.json')).projects['testProj'].architect.build.options.styles).toContain(cssImport);
187189
resetJsonConfigs(tree);
188-
tree.delete('src/styles.styl');
190+
tree.delete(`${sourceRoot}/styles.styl`);
189191
});
190192

191193
it('should properly add web animations', () => {
@@ -202,7 +204,7 @@ import 'web-animations-js'; // Run \`npm install --save web-animations-js\`.
202204
* that is built with AngularCLI v7.3 or above. All else are considered below v7.3.
203205
*/
204206
it('should enable es5BrowserSupport on projects with ng cli version >= 7.3', () => {
205-
tree.create('src/polyfills.ts', '');
207+
tree.create(`${sourceRoot}/polyfills.ts`, '');
206208
const newJson: any = JSON.parse(tree.read('/angular.json').toString());
207209
newJson.projects['testProj'].architect.build.options['es5BrowserSupport'] = false;
208210
tree.overwrite('/angular.json', JSON.stringify(newJson));
@@ -226,11 +228,11 @@ import 'web-animations-js'; // Run \`npm install --save web-animations-js\`.
226228
import 'web-animations-js'; // Run \`npm install --save web-animations-js\`.
227229
`;
228230

229-
tree.create('src/polyfills.ts', polyfills);
231+
tree.create(`${sourceRoot}/polyfills.ts`, polyfills);
230232
const newJson: any = JSON.parse(tree.read('/angular.json').toString());
231233
newJson.projects['testProj'].architect.build.options['es5BrowserSupport'] = false;
232234
tree.overwrite('/angular.json', JSON.stringify(newJson));
233235
runner.runSchematic('ng-add', { polyfills: true }, tree);
234-
expect(tree.readContent('src/polyfills.ts').replace(/\r\n/g, '\n')).toEqual(result.replace(/\r\n/g, '\n'));
236+
expect(tree.readContent(`${sourceRoot}/polyfills.ts`).replace(/\r\n/g, '\n')).toEqual(result.replace(/\r\n/g, '\n'));
235237
});
236238
});

projects/igniteui-angular/schematics/ng-add/index.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { chain, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
22
import { Options } from '../interfaces/options';
33
import { installPackageJsonDependencies } from '../utils/package-handler';
4-
import { logSuccess, addDependencies, overwriteJsonFile, getPropertyFromWorkspace } from '../utils/dependency-handler';
4+
import { logSuccess, addDependencies, overwriteJsonFile,
5+
getPropertyFromWorkspace, getConfigFile } from '../utils/dependency-handler';
56

67
import { addResetCss } from './add-normalize';
7-
import { getWorkspace } from '@schematics/angular/utility/config';
8+
import { getWorkspace, getConfig } from '@schematics/angular/utility/config';
89
import { WorkspaceSchema } from '@schematics/angular/utility/workspace-models';
910

1011

@@ -17,7 +18,9 @@ function propertyExistsInWorkspace(targetProp: string, workspace: WorkspaceSchem
1718
}
1819

1920
function enablePolyfills(tree: Tree, context: SchematicContext): string {
20-
const targetFile = 'src/polyfills.ts';
21+
const workspace = getWorkspace(tree);
22+
const project = workspace.projects[workspace.defaultProject];
23+
const targetFile = getConfigFile(project, 'polyfills');
2124
if (!tree.exists(targetFile)) {
2225
context.logger.warn(`${targetFile} not found. You may need to update polyfills.ts manually.`);
2326
return;
@@ -50,7 +53,8 @@ function readInput(options: Options): Rule {
5053
if (options.polyfills) {
5154
const workspace = getWorkspace(tree);
5255
const targetProperty = 'es5BrowserSupport';
53-
const polyfillsFile = 'src/polyfills.ts';
56+
const project = workspace.projects[workspace.defaultProject];
57+
const polyfillsFile = getConfigFile(project, 'polyfills');
5458
const propertyExists = propertyExistsInWorkspace(targetProperty, workspace);
5559
let polyfillsData = tree.read(polyfillsFile).toString();
5660
if (propertyExists) {

projects/igniteui-angular/schematics/utils/dependency-handler.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ function getTargetedProjectOptions(project: WorkspaceProject<ProjectType>, targe
2626
throw new SchematicsException(`Cannot determine the project's configuration for: ${target}`);
2727
}
2828

29-
function getMainFile(project: WorkspaceProject<ProjectType>): string {
29+
export function getConfigFile(project: WorkspaceProject<ProjectType>, option: string): string {
3030
const buildOptions = getTargetedProjectOptions(project, 'build');
31-
if (!buildOptions.main) {
32-
throw new SchematicsException(`Could not find the project main file inside of the ` +
31+
if (!buildOptions[option]) {
32+
throw new SchematicsException(`Could not find the project ${option} file inside of the ` +
3333
`workspace config (${project.sourceRoot})`);
3434
}
3535

36-
return buildOptions.main;
36+
return buildOptions[option];
3737
}
3838

3939
export function overwriteJsonFile(tree: Tree, targetFile: string, data: any) {
@@ -113,7 +113,7 @@ function includeDependencies(pkgJson: any, context: SchematicContext, tree: Tree
113113
const workspace = getWorkspace(tree);
114114
const project = workspace.projects[workspace.defaultProject];
115115
const projectOptions = getTargetedProjectOptions(project, 'build');
116-
const mainTsPath = getMainFile(project);
116+
const mainTsPath = getConfigFile(project, 'main');
117117
const hammerImport = 'import \'hammerjs\';\n';
118118
const mainTsContent = tree.read(mainTsPath).toString();
119119
// if there are no elements in the architect.build.options.scripts array that contain hammerjs

projects/igniteui-angular/src/lib/calendar/calendar.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ <h2 class="igx-calendar__header-date">
4747
[@animateChange]="animationAction"
4848
(@animateChange.done)="animationDone($event)">
4949
<igx-days-view *ngFor="let view of dayViews; index as i;" [changeDaysView]="true" #days
50+
[selection]="selection"
5051
[locale]="locale"
5152
[value]="value"
5253
[viewDate]="getViewDate(i)"
5354
[weekStart]="weekStart"
5455
[formatOptions]="formatOptions"
5556
[formatViews]="formatViews"
56-
[selection]="selection"
5757
[disabledDates]="disabledDates"
5858
[specialDates]="specialDates"
5959
[hideOutsideDays]="hideOutsideDays"

projects/igniteui-angular/src/lib/carousel/README.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A carousel component is used to browse or navigate through a collection of slides - galleries of images,
44
cards, on-boarding tutorials or page-based interfaces. It can be used as a separate full screen element
5-
or inside another component.
5+
or inside another component.
66
A walkthrough of how to get started can be found [here](https://www.infragistics.com/products/ignite-ui-angular/angular/components/carousel.html)
77

88
# API Summary `igx-carousel`
@@ -13,6 +13,10 @@ A walkthrough of how to get started can be found [here](https://www.infragistics
1313
| `pause` | boolean | Should the carousel stop playing on user interaction. Defaults to `true`. |
1414
| `interval` | number | The amount of time in milliseconds between slides transition. |
1515
| `navigation` | boolean | Controls should the carousel render the left/right navigation buttons. Defaults to `true`. |
16+
| `keyboardSupport` | boolean | Controls should the keyboard navigation should be supported. Defaults to `true`. |
17+
| `maximumIndicatorsCount` | number | The number of visible indicators. Defaults to `5`. |
18+
| `indicatorsOrientation` | CarouselIndicatorsOrientation | Controls whether the indicators should be previewed on top or on bottom of carousel. Defaults to `bottom`. |
19+
| `animationType` | CarouselAnimationType | Controls what animation should be played when slides are changing. Defaults to `slide`. |
1620
| `total` | number | The number of slides the carousel currently has. |
1721
| `current` | number | The index of the slide currently showing. |
1822
| `isPlaying` | boolean | Returns whether the carousel is paused/playing. |
@@ -31,6 +35,26 @@ A walkthrough of how to get started can be found [here](https://www.infragistics
3135
| `get(index: Number)` | IgxSlide or void | Returns the slide with the given index or null. |
3236
| `select(slide: IgxSlide, direction: Direction)`| void | Selects the slide and the direction to transition to. Emits `onSlideChanged` event. |
3337

38+
### Keyboard navigation
39+
Keyboard navigation will be enabled when the **IgxCarousel** component is focused and `keyboardSupport` property is set to `true`:
40+
- Arrow keys will navigate through the slides.
41+
- `Home` will focus the first slide inside the carousel view.
42+
- `End` will focus the last slide inside the carousel view.
43+
44+
### Templates
45+
The **IgxCarousel** supports templating of its indicators
46+
47+
#### Defining item template:
48+
```html
49+
<igx-carousel #carousel>
50+
...
51+
<ng-template igxCarouselIndicator let-slide>
52+
<igx-icon *ngIf="slide.active" fontSet="material">brightness_7</igx-icon>
53+
<igx-icon *ngIf="!slide.active" fontSet="material">brightness_5</igx-icon>
54+
</ng-template>
55+
</igx-carousel>
56+
```
57+
3458
# API Summary `igx-slide`
3559
| Name | Type | Description |
3660
|:----------|:-------------:|:------|
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,35 @@
1-
<div tabindex="0" aria-label="carousel" class="igx-carousel"
2-
(mouseenter)="stop()"
3-
(mouseleave)="play()"
4-
(swipeleft)="next()"
5-
(swiperight)="prev()"
6-
(tap)="isPlaying ? stop() : play()">
7-
<ul class="igx-carousel__indicators" [hidden]="slides.length <= 1">
8-
<li *ngFor="let slide of slides" [attr.aria-label]="setAriaLabel(slide)" [attr.aria-selected]="slide.active" [class.active]="slide.active === true"
9-
(click)="select(slide)"></li>
10-
</ul>
11-
<div class="igx-carousel__inner" role="list">
12-
<ng-content></ng-content>
1+
<ng-template #defaultIndicator let-slide>
2+
<div class="igx-nav-dot"
3+
[class.igx-nav-dot--active]="slide.active"
4+
>
135
</div>
14-
<div *ngIf="navigation">
15-
<a role="button" tabindex="0" class="igx-carousel__arrow--prev" (click)="prev()" [hidden]="!slides.length">
16-
<igx-icon fontSet="material">arrow_back</igx-icon>
17-
</a>
18-
<a role="button" tabindex="0" class="igx-carousel__arrow--next" (click)="next()" [hidden]="!slides.length">
19-
<igx-icon fontSet="material">arrow_forward</igx-icon>
20-
</a>
6+
</ng-template>
7+
8+
9+
<div *ngIf="showIndicators" [ngClass]="indicatorsOrientationClass">
10+
<div *ngFor="let slide of slides"
11+
class="igx-carousel-indicators__indicator"
12+
(click)="select(slide)"
13+
[attr.aria-label]="setAriaLabel(slide)"
14+
[attr.aria-selected]="slide.active">
15+
<ng-container *ngTemplateOutlet="getIndicatorTemplate; context: {$implicit: slide};"></ng-container>
2116
</div>
2217
</div>
18+
19+
<div *ngIf="showIndicatorsLabel" [ngClass]="indicatorsOrientationClass">
20+
<span class="igx-carousel__label">{{getCarouselLabel}}</span>
21+
</div>
22+
23+
<div class="igx-carousel__inner" role="list">
24+
<ng-content></ng-content>
25+
</div>
26+
27+
<ng-container *ngIf="navigation">
28+
<a role="button" tabindex="0" class="igx-carousel__arrow--prev" (click)="prev()" [hidden]="!slides.length">
29+
<igx-icon fontSet="material">arrow_back</igx-icon>
30+
</a>
31+
<a role="button" tabindex="0" class="igx-carousel__arrow--next" (click)="next()" [hidden]="!slides.length">
32+
<igx-icon fontSet="material">arrow_forward</igx-icon>
33+
</a>
34+
</ng-container>
35+

0 commit comments

Comments
 (0)