Skip to content

Commit 92e8407

Browse files
committed
chore(expansion-panel): address review comments
1 parent 05610e6 commit 92e8407

File tree

5 files changed

+13
-20
lines changed

5 files changed

+13
-20
lines changed

projects/igniteui-angular/src/lib/expansion-panel/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ The following outputs are available in the **igx-expansion-panel** component:
5656

5757
| Name | Cancelable | Description | Parameters
5858
| :--- | :--- | :--- | :--- |
59-
| `onCollapsed` | `false` | Emitted when the panel is collapsed | `{ event: Event, panel: IgxExpansionPanelComponent }` |
60-
| `onExpanded` | `false` | Emitted when the panel is expanded | `{ event: Event, panel: IgxExpansionPanelComponent }` |
59+
| `onCollapsed` | `false` | Emitted when the panel is collapsed | `IExpansionPanelEventArgs` |
60+
| `onExpanded` | `false` | Emitted when the panel is expanded | `IExpansionPanelEventArgs` |
6161

6262

6363
### Methods
@@ -89,7 +89,7 @@ The following outputs are available in the **igx-expansion-panel-header** compon
8989

9090
| Name | Cancelable | Description | Parameters
9191
| :--- | :--- | :--- | :--- |
92-
| `onInteraction` | `true` | Emitted when a user interacts with the header host | `{ event: Event, panel: IgxExpansionPanelComponent, cancel: boolean }` |
92+
| `onInteraction` | `true` | Emitted when a user interacts with the header host | `IExpansionPanelCancelableEventArgs` |
9393

9494
## IgxExpansionPanelBodyComponent
9595
### Inputs

projects/igniteui-angular/src/lib/expansion-panel/expansion-panel-header.component.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,15 @@ export class IgxExpansionPanelHeaderComponent {
4949
private customIconRef: ElementRef;
5050

5151
/** @hidden @internal */
52-
@ViewChild(IgxIconComponent, { read: IgxIconComponent })
53-
public defaultIconRef: IgxIconComponent;
52+
@ViewChild(IgxIconComponent, { read: ElementRef })
53+
public defaultIconRef: ElementRef;
5454

5555
/**
5656
* Returns a reference to the `igx-expansion-panel-icon` element;
5757
* If `iconPosition` is `NONE` - return null;
5858
*/
5959
public get iconRef(): ElementRef {
60-
const defaultRef = this.defaultIconRef ? this.defaultIconRef.el : null;
61-
const customRef = this.customIconRef ? this.customIconRef : null;
62-
const renderedTemplate = this.iconTemplate ? customRef : defaultRef;
60+
const renderedTemplate = this.customIconRef ?? this.defaultIconRef;
6361
return this.iconPosition !== ICON_POSITION.NONE ? renderedTemplate : null;
6462
}
6563

@@ -141,7 +139,7 @@ export class IgxExpansionPanelHeaderComponent {
141139
/**
142140
* Emitted whenever a user interacts with the header host
143141
* ```typescript
144-
* handleInteraction(event: IExpansionPanelCancelabelEventArgs) {
142+
* handleInteraction(event: IExpansionPanelCancelableEventArgs) {
145143
* ...
146144
* }
147145
* ```

projects/igniteui-angular/src/lib/expansion-panel/expansion-panel.component.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ export class IgxExpansionPanelComponent implements IgxExpansionPanelBase, AfterC
119119
/**
120120
* Emitted when the expansion panel finishes collapsing
121121
* ```typescript
122-
* handleCollapsed(event: {
123-
* panel: IgxExpansionPanelComponent,
124-
* event: Event
125-
* })
122+
* handleCollapsed(event: IExpansionPanelEventArgs)
126123
* ```
127124
* ```html
128125
* <igx-expansion-panel (onCollapsed)="handleCollapsed($event)">
@@ -136,10 +133,7 @@ export class IgxExpansionPanelComponent implements IgxExpansionPanelBase, AfterC
136133
/**
137134
* Emitted when the expansion panel finishes expanding
138135
* ```typescript
139-
* handleExpanded(event: {
140-
* panel: IgxExpansionPanelComponent,
141-
* event: Event
142-
* })
136+
* handleExpanded(event: IExpansionPanelEventArgs)
143137
* ```
144138
* ```html
145139
* <igx-expansion-panel (onExpanded)="handleExpanded($event)">

src/app/expansion-panel/expansion-panel-sample.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div class="game-board">
88
<igx-expansion-panel [animationSettings]="animationSettings" class="game-board__collapsible" (onCollapsed)="handleCollapsed($event)"
99
(onExpanded)="handleExpanded($event)" #collapsibleComponent [collapsed]="false">
10-
<igx-expansion-panel-header [iconPosition]="iconPosition" (onInterraction)="onInterraction($event)"
10+
<igx-expansion-panel-header [iconPosition]="iconPosition" (onInteraction)="onInteraction($event)"
1111
[disabled]="false">
1212
<igx-expansion-panel-title>Current Winning Player:</igx-expansion-panel-title>
1313
<igx-expansion-panel-description>{{ getWinningPlayer }}</igx-expansion-panel-description>

src/app/expansion-panel/expansion-panel-sample.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IgxExpansionPanelComponent, growVerIn, growVerOut, scaleInVerTop } from 'igniteui-angular';
1+
import { IgxExpansionPanelComponent, growVerIn, growVerOut, scaleInVerTop, IExpansionPanelEventArgs } from 'igniteui-angular';
22
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
33
import { AnimationReferenceMetadata, useAnimation } from '@angular/animations';
44

@@ -83,7 +83,8 @@ export class ExpansionPanelSampleComponent implements OnInit {
8383
handleExpanded(event) {
8484
console.log(`I'm expanding!`, event);
8585
}
86-
onInterraction(event) {
86+
onInteraction(event: IExpansionPanelEventArgs) {
87+
console.log(event.owner);
8788
console.log(`Header's touched!`, event);
8889
}
8990

0 commit comments

Comments
 (0)