Skip to content

Commit 4ce5e81

Browse files
authored
Merge branch 'master' into puppeteer
2 parents 73fc8fc + 4c531d9 commit 4ce5e81

37 files changed

+296
-104
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ All notable changes for each version of this project will be documented in this
2323
- **Breaking Change** The `onSlideChanged`, `onSlideAdded`, `onSlideRemoved`, `onCarouselPaused` and `onCarouselPlaying` outputs have been renamed to `slideChanged`, `slideAdded`, `slideRemoved`, `carouselPaused` and `carouselPlaying` to not violate the no on-prefixed outputs convention. Automatic migrations are available and will be applied on `ng update`.
2424
- `IgxRadio`, `IgxRadioGroup`
2525
- Added component validation along with styles for invalid state
26-
26+
- `IgxBadge`
27+
- Added `shape` property that controls the shape of the badge and can be either `square` or `rounded`. The default shape of the badge is rounded.
28+
- `IgxAvatar`
29+
- **Breaking Change** The `roundShape` property has been deprecated and will be removed in a future version. Users can control the shape of the avatar by the newly added `shape` attribute that can be `square`, `rounded` or `circle`. The default shape of the avatar is `square`.
2730

2831
## 15.0.1
2932

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ There are many ways in which you can [participate](https://github.com/IgniteUI/i
4141

4242
## Browser Support
4343

44-
![chrome_48x48](https://user-images.githubusercontent.com/2188411/168109445-fbd7b217-35f9-44d1-8002-1eb97e39cdc6.png) | ![firefox_48x48](https://user-images.githubusercontent.com/2188411/168109465-e46305ee-f69f-4fa5-8f4a-14876f7fd3ca.png) | ![edge_48x48](https://user-images.githubusercontent.com/2188411/168109472-a730f8c0-3822-4ae6-9f54-785a66695245.png) | ![opera_48x48](https://user-images.githubusercontent.com/2188411/168109520-b6865a6c-b69f-44a4-9948-748d8afd687c.png) | ![safari_48x48](https://user-images.githubusercontent.com/2188411/168109527-6c58f2cf-7386-4b97-98b1-cfe0ab4e8626.png) | ![ie_48x48](https://user-images.githubusercontent.com/2188411/168135931-ce5259bb-5b26-4003-8b89-dbee3d4f247c.png)
45-
--- | --- | --- | --- | --- |:---:|
46-
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11* |
44+
| ![chrome][] | ![firefox][] | ![edge][] | ![opera][] | ![safari][] | ![ie][] |
45+
|:-----------:|:------------:|:---------:|:----------:|:-----------:|:-------:|
46+
| Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11* |
4747

4848
\* *IE 11 is only supported in Ignite UI for Angular < 13.0.0*
4949

@@ -293,4 +293,14 @@ For information on that license, please go to our website [https://www.infragist
293293

294294

295295

296+
<!-- browser logos -->
297+
[chrome]: https://user-images.githubusercontent.com/2188411/168109445-fbd7b217-35f9-44d1-8002-1eb97e39cdc6.png "Google Chrome"
298+
[firefox]: https://user-images.githubusercontent.com/2188411/168109465-e46305ee-f69f-4fa5-8f4a-14876f7fd3ca.png "Mozilla Firefox"
299+
[edge]: https://user-images.githubusercontent.com/2188411/168109472-a730f8c0-3822-4ae6-9f54-785a66695245.png "Microsoft Edge"
300+
[opera]: https://user-images.githubusercontent.com/2188411/168109520-b6865a6c-b69f-44a4-9948-748d8afd687c.png "Opera"
301+
[safari]: https://user-images.githubusercontent.com/2188411/168109527-6c58f2cf-7386-4b97-98b1-cfe0ab4e8626.png "Safari"
302+
[ie]: https://user-images.githubusercontent.com/2188411/168135931-ce5259bb-5b26-4003-8b89-dbee3d4f247c.png "Internet Explorer"
303+
304+
305+
296306

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"@scheme": "../../common/schema/binding.schema.json",
3+
"changes": [
4+
{
5+
"name": "roundShape",
6+
"replaceWith": "shape",
7+
"valueTransform": "roundShape_is_deprecated",
8+
"owner": {
9+
"selector": "igx-avatar",
10+
"type": "component"
11+
}
12+
}
13+
]
14+
}

projects/igniteui-angular/migrations/update-15_1_0/index.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,20 @@ describe(`Update to ${version}`, () => {
122122
<igx-query-builder (densityChanged)="onDensityChanged($event)"></igx-query-builder>
123123
<igx-tree (densityChanged)="onDensityChanged($event)"></igx-tree>`);
124124
});
125+
126+
it('should replace avatar roundShape property with shape', async () => {
127+
appTree.create(`/testSrc/appPrefix/component/test.component.html`,
128+
`
129+
<igx-avatar initials="MS" [roundShape]="true" size="large"></igx-avatar>
130+
`
131+
);
132+
133+
const tree = await schematicRunner.runSchematic(migrationName, { shouldInvokeLS: false }, appTree);
134+
135+
expect(tree.readContent('/testSrc/appPrefix/component/test.component.html')).toEqual(
136+
`
137+
<igx-avatar initials="MS" shape="circle" size="large"></igx-avatar>
138+
`
139+
);
140+
});
125141
});

projects/igniteui-angular/migrations/update-15_1_0/index.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
Tree
55
} from '@angular-devkit/schematics';
66
import { Options } from '../../schematics/interfaces/options';
7-
import { UpdateChanges } from '../common/UpdateChanges';
7+
import { BoundPropertyObject, InputPropertyType, UpdateChanges } from '../common/UpdateChanges';
88

99
const version = '15.1.0';
1010

@@ -13,5 +13,19 @@ export default (options: Options): Rule => async (host: Tree, context: Schematic
1313

1414
const update = new UpdateChanges(__dirname, host, context);
1515
update.shouldInvokeLS = options['shouldInvokeLS'];
16+
update.addValueTransform('roundShape_is_deprecated', (args: BoundPropertyObject): void => {
17+
args.bindingType = InputPropertyType.STRING;
18+
19+
switch (args.value) {
20+
case 'true':
21+
args.value = 'circle';
22+
break;
23+
case 'false':
24+
args.value = 'square';
25+
break;
26+
default:
27+
args.value += ` ? 'circle' : 'square' `;
28+
}
29+
});
1630
update.applyChanges();
1731
};

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A walkthrough of how to get started can be found [here](https://www.infragistics
55

66
# Usage
77
```html
8-
<igx-avatar [roundShape]="true" icon="person" bgColor="#0375be" data-init="SS">
8+
<igx-avatar shape="rounded" icon="person" bgColor="#0375be" data-init="SS">
99
</igx-avatar>
1010
```
1111

@@ -18,7 +18,7 @@ A walkthrough of how to get started can be found [here](https://www.infragistics
1818
| `icon` | string | Set the icon of the avatar. Currently all icons from the material icon set are supported. Not applicable for initials and image avatars. |
1919
| `bgColor` | string | Set the background color of initials or icon avatars. |
2020
| `color` | string | Set the color of initials or icon avatars. (optional) |
21-
| `roundShape` | boolean | Set the shape of the avatar to circle. The default shape is square. |
21+
| `shape` | boolean | Set the shape of the avatar to rounded. The default shape is square. |
2222
| `size` | string | Set the size of the avatar to either small, medium, or large. |
2323

2424
*You can also set all igx-avatar properties programmatically.
@@ -27,7 +27,7 @@ A walkthrough of how to get started can be found [here](https://www.infragistics
2727

2828
Using `igx-avatar` tag to include it into your app.
2929
```html
30-
<igx-avatar [roundShape]="true" icon="person" bgColor="#0375be" data-init="SS">
30+
<igx-avatar icon="person" bgColor="#0375be" data-init="SS">
3131
</igx-avatar>
3232
```
3333

projects/igniteui-angular/src/lib/avatar/avatar.component.spec.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe('Avatar', () => {
1212

1313
const classes = {
1414
round: `${baseClass}--rounded`,
15+
circle: `${baseClass}--circle`,
1516
small: `${baseClass}--small`,
1617
medium: `${baseClass}--medium`,
1718
large: `${baseClass}--large`,
@@ -57,13 +58,25 @@ describe('Avatar', () => {
5758
const hostEl = fixture.debugElement.query(By.css(baseClass)).nativeElement;
5859

5960
expect(instance.roundShape).toBeTruthy();
60-
expect(hostEl.classList).toContain(classes.round);
61+
expect(instance.shape).toEqual('circle');
62+
expect(hostEl.classList).toContain(classes.circle);
63+
expect(hostEl.classList).not.toContain(classes.round);
6164

62-
instance.roundShape = false;
65+
instance.shape = "square";
6366

6467
fixture.detectChanges();
6568
expect(instance.roundShape).toBeFalsy();
69+
expect(instance.shape).toEqual('square');
6670
expect(hostEl.classList).not.toContain(classes.round);
71+
expect(hostEl.classList).not.toContain(classes.circle);
72+
73+
instance.shape = "rounded";
74+
75+
fixture.detectChanges();
76+
expect(instance.roundShape).toBeFalsy();
77+
expect(instance.shape).toEqual('rounded');
78+
expect(hostEl.classList).toContain(classes.round);
79+
expect(hostEl.classList).not.toContain(classes.circle);
6780
});
6881

6982
it('Can change its size', () => {
@@ -101,6 +114,7 @@ describe('Avatar', () => {
101114
expect(instance.initials).toBeUndefined();
102115
expect(instance.src).toBeUndefined();
103116
expect(instance.icon).toBeUndefined();
117+
expect(instance.shape).toEqual('square');
104118

105119
expect(hostEl.textContent).toEqual('TEST');
106120
});
@@ -188,7 +202,7 @@ class InitAvatarComponent {
188202
[bgColor]="bgColor"
189203
[color]="color"
190204
size="small"
191-
[roundShape]="roundShape">
205+
[roundShape]="true">
192206
</igx-avatar>`
193207
})
194208
class AvatarWithAttribsComponent {
@@ -197,7 +211,6 @@ class AvatarWithAttribsComponent {
197211
public initials = 'ZK';
198212
public color = 'orange';
199213
public bgColor = 'royalblue';
200-
public roundShape = 'true';
201214
}
202215

203216
@Component({

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

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export type IgxAvatarType = (typeof IgxAvatarType)[keyof typeof IgxAvatarType];
4646
*
4747
* @example
4848
* ```html
49-
* <igx-avatar initials="MS" [roundShape]="true" size="large">
49+
* <igx-avatar initials="MS" shape="rounded" size="large">
5050
* </igx-avatar>
5151
* ```
5252
*/
@@ -116,18 +116,43 @@ export class IgxAvatarComponent implements OnInit {
116116
public id = `igx-avatar-${NEXT_ID++}`;
117117

118118
/**
119-
* Sets a round shape to the avatar, if `[roundShape]` is set to `true`.
119+
* @deprecated in version 15.1.0.
120+
* Sets a circular shape to the avatar, if `[roundShape]` is set to `true`.
120121
* By default the shape of the avatar is a square.
121-
*
122+
*
122123
* @example
123124
* ```html
124125
* <igx-avatar [roundShape]="true" ></igx-avatar>
125126
* ```
126127
*/
128+
/** @hidden @internal */
129+
@Input()
130+
@HostBinding('class.igx-avatar--circle')
131+
public get roundShape() {
132+
return this.shape === 'circle';
133+
}
127134

128-
@HostBinding('class.igx-avatar--rounded')
135+
public set roundShape(value: boolean) {
136+
this.shape = value === true ? 'circle' : 'square';
137+
}
138+
139+
/**
140+
* Sets square, rounded or circular shape to the avatar.
141+
* By default the shape of the avatar is square.
142+
*
143+
* @example
144+
* ```html
145+
* <igx-avatar shape="rounded"></igx-avatar>
146+
* ```
147+
*/
129148
@Input()
130-
public roundShape = false;
149+
public shape: 'square' | 'rounded' | 'circle' = 'square';
150+
151+
/** @hidden @internal */
152+
@HostBinding('class.igx-avatar--rounded')
153+
public get isRounded(): boolean {
154+
return this.shape === 'rounded';
155+
}
131156

132157
/**
133158
* Sets the color of the avatar's initials or icon.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ A walkthrough of how to get started can be found [here](https://www.infragistics
2222

2323
Using `igx-badge` with the `igx-avatar` component to show active status.
2424
```html
25-
<igx-avatar [src]="src" [roundShape]="true">
25+
<igx-avatar [src]="src">
2626
<igx-badge type="info" value="8"></igx-badge>
2727
</igx-avatar>
2828
```

projects/igniteui-angular/src/lib/banner/banner.component.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,7 @@ export class IgxBannerSampleComponent {
555555
<igx-card>
556556
<igx-card-header class="compact">
557557
<igx-avatar
558-
src="https://www.infragistics.com/angular-demos/assets/images/card/avatars/brad_stanley.jpg"
559-
[roundShape]="true">
558+
src="https://www.infragistics.com/angular-demos/assets/images/card/avatars/brad_stanley.jpg">
560559
</igx-avatar>
561560
<div class="igx-card-header__tgroup">
562561
<h3 class="igx-card-header__title--small">Brad Stanley</h3>

0 commit comments

Comments
 (0)