Skip to content

Commit 6e35259

Browse files
authored
Merge branch 'master' into dTsvetkov/fix-cell-styling-warnings
2 parents 91364de + e64adbe commit 6e35259

File tree

25 files changed

+355
-195
lines changed

25 files changed

+355
-195
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes for each version of this project will be documented in this
44

55
## 12.0.0
66

7+
### New Features
8+
- `IgxForOf`, `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
9+
- **Behavioral Change** - Virtual containers now scroll smoothly when using the mouse wheel(s) to scroll them horizontally or vertically. This behavior more closely resembles the scrolling behavior of non-virtualized containers in most modern browsers.
10+
11+
712
### Themes:
813
- Breaking Changes:
914
- `IgxButton` theme has been simplified. The number of theme params (`igx-button-theme`) has been reduced significantly and no longer includes prefixed parameters (`flat-*`, `raised-*`, etc.). See the migration guide to update existing button themes. Updates performed with `ng update` will migrate existing button themes but some additional tweaking may be required to account for the abscense of prefixed params.
@@ -16,6 +21,8 @@ All notable changes for each version of this project will be documented in this
1621
```
1722

1823

24+
25+
1926
## 11.1.1
2027

2128
### New Features

projects/igniteui-angular/migrations/migration-collection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@
9595
"version": "11.1.0",
9696
"description": "Updates Ignite UI for Angular from v11.0.x to v11.1.0",
9797
"factory": "./update-11_1_0"
98+
},
99+
"migration-20": {
100+
"version": "12.0.0",
101+
"description": "Updates Ignite UI for Angular from v11.1.x to v12.0.0",
102+
"factory": "./update-12_0_0"
98103
}
99104
}
100105
}

projects/igniteui-angular/migrations/update-12_0_0/changes/theme-props.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,41 @@
11
{
22
"$schema": "../../common/schema/theme-props.schema.json",
33
"changes": [
4+
{
5+
"name": "$border-radius-round",
6+
"replaceWith": "$border-radius",
7+
"owner": "igx-avatar-theme"
8+
},
9+
{
10+
"name": "$border-radius-square",
11+
"replaceWith": "$border-radius",
12+
"owner": "igx-avatar-theme"
13+
},
14+
{
15+
"name": "$initials-background",
16+
"replaceWith": "$background",
17+
"owner": "igx-avatar-theme"
18+
},
19+
{
20+
"name": "$initials-color",
21+
"replaceWith": "$color",
22+
"owner": "igx-avatar-theme"
23+
},
24+
{
25+
"name": "$icon-background",
26+
"replaceWith": "$background",
27+
"owner": "igx-avatar-theme"
28+
},
29+
{
30+
"name": "$icon-color",
31+
"replaceWith": "$color",
32+
"owner": "igx-avatar-theme"
33+
},
34+
{
35+
"name": "$image-background",
36+
"replaceWith": "$background",
37+
"owner": "igx-avatar-theme"
38+
},
439
{
540
"name": "$flat-border-radius",
641
"replaceWith": "$border-radius",
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
describe('Update to 12.0.0', () => {
7+
let appTree: UnitTestTree;
8+
const runner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json'));
9+
const configJson = {
10+
defaultProject: 'testProj',
11+
projects: {
12+
testProj: {
13+
sourceRoot: '/testSrc'
14+
}
15+
},
16+
schematics: {
17+
'@schematics/angular:component': {
18+
prefix: 'appPrefix'
19+
}
20+
}
21+
};
22+
23+
const migrationName = 'migration-20';
24+
25+
beforeEach(() => {
26+
appTree = new UnitTestTree(new EmptyTree());
27+
appTree.create('/angular.json', JSON.stringify(configJson));
28+
});
29+
30+
it('should update avatar theme args', async () => {
31+
appTree.create(
32+
`/testSrc/appPrefix/component/test.component.scss`,
33+
`
34+
$theme: igx-avatar-theme(
35+
$initials-background: white,
36+
$icon-background: green,
37+
$image-background: red,
38+
$initials-color: black,
39+
$icon-color: gold,
40+
$border-radius-round: 14px,
41+
$border-radius-square: 12px
42+
);
43+
`
44+
);
45+
46+
const tree = await runner
47+
.runSchematicAsync(migrationName, {}, appTree)
48+
.toPromise();
49+
50+
expect(
51+
tree.readContent('/testSrc/appPrefix/component/test.component.scss')
52+
).toEqual(
53+
`
54+
$theme: igx-avatar-theme(
55+
$background: white,
56+
$color: black,
57+
$border-radius: 14px
58+
);
59+
`
60+
);
61+
});
62+
});
Lines changed: 11 additions & 0 deletions
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 = '12.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+
};

projects/igniteui-angular/src/lib/chips/chip.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
</div>
3838

3939
<ng-template #defaultSelectIcon>
40-
<igx-icon>done</igx-icon>
40+
<igx-icon [attr.aria-label]="resourceStrings.igx_chip_select">done</igx-icon>
4141
</ng-template>
4242

4343
<ng-template #defaultRemoveIcon>
44-
<igx-icon>cancel</igx-icon>
44+
<igx-icon [attr.aria-label]="resourceStrings.igx_chip_remove">cancel</igx-icon>
4545
</ng-template>

projects/igniteui-angular/src/lib/chips/chip.component.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ import {
2222
IDropDroppedEventArgs
2323
} from '../directives/drag-drop/drag-drop.directive';
2424
import { IBaseEventArgs } from '../core/utils';
25+
import { IChipResourceStrings } from '../core/i18n/chip-resources';
26+
import { CurrentResourceStrings } from '../core/i18n/resources';
2527
import { fromEvent } from 'rxjs';
2628
import { take, filter } from 'rxjs/operators';
2729

28-
2930
export interface IBaseChipEventArgs extends IBaseEventArgs {
3031
originalEvent: IDragBaseEventArgs | IDropBaseEventArgs | KeyboardEvent | MouseEvent | TouchEvent;
3132
owner: IgxChipComponent;
@@ -91,6 +92,17 @@ export class IgxChipComponent extends DisplayDensityBase {
9192
@Input()
9293
public id = `igx-chip-${CHIP_ID++}`;
9394

95+
/**
96+
* Returns the `role` attribute of the chip.
97+
*
98+
* @example
99+
* ```typescript
100+
* let chipRole = this.chip.role;
101+
* ```
102+
*/
103+
@HostBinding('attr.role')
104+
public role = 'option';
105+
94106
/**
95107
* An @Input property that sets the value of `tabindex` attribute. If not provided it will use the element's tabindex if set.
96108
*
@@ -240,6 +252,7 @@ export class IgxChipComponent extends DisplayDensityBase {
240252
* <igx-chip #myChip [id]="'igx-chip-1'" [selectable]="true" [(selected)]="model.isSelected">
241253
* ```
242254
*/
255+
@HostBinding('attr.aria-selected')
243256
@Input()
244257
public set selected(newValue: boolean) {
245258
this.changeSelection(newValue);
@@ -298,6 +311,22 @@ export class IgxChipComponent extends DisplayDensityBase {
298311
return this.chipArea.nativeElement.style.backgroundColor;
299312
}
300313

314+
/**
315+
* An accessor that sets the resource strings.
316+
* By default it uses EN resources.
317+
*/
318+
@Input()
319+
public set resourceStrings(value: IChipResourceStrings) {
320+
this._resourceStrings = Object.assign({}, this._resourceStrings, value);
321+
}
322+
323+
/**
324+
* An accessor that returns the resource strings.
325+
*/
326+
public get resourceStrings(): IChipResourceStrings {
327+
return this._resourceStrings;
328+
}
329+
301330
/**
302331
* Emits an event when the `IgxChipComponent` moving starts.
303332
* Returns the moving `IgxChipComponent`.
@@ -494,6 +523,7 @@ export class IgxChipComponent extends DisplayDensityBase {
494523
protected _selected = false;
495524
protected _selectedItemClass = 'igx-chip__item--selected';
496525
protected _movedWhileRemoving = false;
526+
private _resourceStrings = CurrentResourceStrings.ChipResStrings;
497527

498528
constructor(public cdr: ChangeDetectorRef, public elementRef: ElementRef, private renderer: Renderer2,
499529
@Optional() @Inject(DisplayDensityToken) protected _displayDensityOptions: IDisplayDensityOptions) {

projects/igniteui-angular/src/lib/chips/chips-area.component.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,29 @@ export class IgxChipsAreaComponent implements DoCheck, AfterViewInit, OnDestroy
8484
return classes.join(' ');
8585
}
8686

87+
/**
88+
* Returns the `role` attribute of the chips area.
89+
*
90+
* @example
91+
* ```typescript
92+
* let chipsAreaRole = this.chipsArea.role;
93+
* ```
94+
*/
95+
@HostBinding('attr.role')
96+
public role = 'listbox';
97+
98+
/**
99+
* Returns the `aria-label` attribute of the chips area.
100+
*
101+
* @example
102+
* ```typescript
103+
* let ariaLabel = this.chipsArea.ariaLabel;
104+
* ```
105+
*
106+
*/
107+
@HostBinding('attr.aria-label')
108+
public ariaLabel = 'chip area';
109+
87110
/**
88111
* An @Input property that sets the width of the `IgxChipsAreaComponent`.
89112
*
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export interface IChipResourceStrings {
2+
igx_chip_remove?: string;
3+
igx_chip_select?: string;
4+
}
5+
6+
export const ChipResourceStringsEN: IChipResourceStrings = {
7+
igx_chip_remove: 'remove chip',
8+
igx_chip_select: 'select chip'
9+
};

projects/igniteui-angular/src/lib/core/i18n/resources.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import { ITimePickerResourceStrings, TimePickerResourceStringsEN } from './time-
44
import { IPaginatorResourceStrings, PaginatorResourceStringsEN } from './paginator-resources';
55
import { cloneValue } from '../utils';
66
import { ICarouselResourceStrings, CarouselResourceStringsEN } from './carousel-resources';
7+
import { IChipResourceStrings, ChipResourceStringsEN } from './chip-resources';
78
import { IListResourceStrings, ListResourceStringsEN } from './list-resources';
89
import { CalendarResourceStringsEN, ICalendarResourceStrings } from './calendar-resources';
910
import { IInputResourceStrings, InputResourceStringsEN } from './input-resources';
1011

1112
export interface IResourceStrings extends IGridResourceStrings, ITimePickerResourceStrings, ICalendarResourceStrings,
12-
ICarouselResourceStrings, IInputResourceStrings, IDateRangePickerResourceStrings, IListResourceStrings, IPaginatorResourceStrings { }
13+
ICarouselResourceStrings, IChipResourceStrings, IInputResourceStrings, IDateRangePickerResourceStrings, IListResourceStrings,
14+
IPaginatorResourceStrings { }
1315

1416
/**
1517
* @hidden
@@ -19,6 +21,7 @@ export const CurrentResourceStrings = {
1921
PaginatorResStrings: cloneValue(PaginatorResourceStringsEN),
2022
TimePickerResStrings: cloneValue(TimePickerResourceStringsEN),
2123
CalendarResStrings: cloneValue(CalendarResourceStringsEN),
24+
ChipResStrings: cloneValue(ChipResourceStringsEN),
2225
DateRangePickerResStrings: cloneValue(DateRangePickerResourceStringsEN),
2326
CarouselResStrings: cloneValue(CarouselResourceStringsEN),
2427
ListResStrings: cloneValue(ListResourceStringsEN),
@@ -50,6 +53,7 @@ export const changei18n = (resourceStrings: IResourceStrings) => {
5053
export const getCurrentResourceStrings = (): IResourceStrings => ({
5154
...CurrentResourceStrings.CalendarResStrings,
5255
...CurrentResourceStrings.CarouselResStrings,
56+
...CurrentResourceStrings.ChipResStrings,
5357
...CurrentResourceStrings.DateRangePickerResStrings,
5458
...CurrentResourceStrings.GridResStrings,
5559
...CurrentResourceStrings.InputResStrings,

0 commit comments

Comments
 (0)