Skip to content

Commit 0d50c6a

Browse files
committed
Merge branch 'master' into mvenkov/update-toggle-event-emitters
2 parents 7459d69 + b5f8978 commit 0d50c6a

40 files changed

+504
-162
lines changed

CHANGELOG.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,27 @@ All notable changes for each version of this project will be documented in this
44
## 10.2.0
55

66
### General
7-
- `IgxDatePicker`
8-
- Added `aria-labelledby` property for the input field. This will ensure the users of assistive technologies will also know what component is used for, upon input focus.
7+
- `IgxGridActions`
8+
- Added `asMenuItems` Input for grid actions - `igx-grid-editing-actions`, `igx-grid-pinning-actions`. When set to true will render the related action buttons as separate menu items with button and label.
99
- `IgxInputGroup`
1010
- **Breaking Change** - Removed `fluent`, `fluent_search`, `bootstrap`, and `indigo` as possible values for the `type` input property.
1111
- **Behavioral Change** - The styling of the input group is now dictated by the theme being used. The remaining `types` - `line`, `border`, and `box` will only have effect on the styling when used with the `material` theme. The `search` type will affect styling when used with all themes. Changing the theme at runtime will not change the styling of the input group, a page refresh is required.
1212
- `IgxOverlay`
1313
- **Breaking Change** - `target` property in `PositionSettings` has been deprecated. You can set the attaching target for the component to show in `OverlaySettings` instead.
14+
- `IgxToggleDirective`
15+
- `onAppended`, `onOpened` and `onClosed` events are emitting now arguments of `ToggleViewEventArgs` type.
16+
- `onOpening` and `onClosing` events are emitting now arguments of `ToggleViewCancelableEventArgs` type.
1417
- `IgxSelect`
1518
- Added `aria-labelledby` property for the items list container(marked as `role="listbox"`). This will ensure the users of assistive technologies will also know what the list items container is used for, upon opening.
1619
- `IgxDatePicker`
1720
- **Breaking Change** - Deprecated the `label` property.
18-
- `IgxGridActions`
19-
- Added `asMenuItems` Input for grid actions - `igx-grid-editing-actions`, `igx-grid-pinning-actions`. When set to true will render the related action buttons as separate menu items with button and label.
20-
- `IgxToggleDirective`
21-
- `onAppended`, `onOpened` and `onClosed` events are emitting now arguments of `ToggleViewEventArgs` type.
22-
- `onOpening` and `onClosing` events are emitting now arguments of `ToggleViewCancelableEventArgs` type.
21+
- Added `aria-labelledby` property for the input field. This will ensure the users of assistive technologies will also know what component is used for, upon input focus.
22+
- `igxNavigationDrawer`
23+
- Added `disableAnimation` property which enables/disables the animation, when toggling the drawer. Set to `false` by default.
24+
- `igxTabs`
25+
- Added `disableAnimation` property which enables/disables the transition animation of the tabs' content. Set to `false` by default.
26+
- `IgxExpansionPanel`
27+
- `IExpansionPanelEventArgs.panel` - Deprecated. Usе `owner` property to get a reference to the panel.
2328

2429

2530
### New Features
@@ -57,6 +62,9 @@ All notable changes for each version of this project will be documented in this
5762
- The component now utilizes the `IgxOverlayService` to position itself in the DOM.
5863
- An additional input property `outlet` has been added to allow users to specify custom Overlay Outlets using the `IgxOverlayOutletDirective`;
5964
- The `position` property now accepts values of type `IgxToastPosition` that work with strict templates.
65+
- `IgxExpansionPanelHeader`
66+
- `onInteraction` is now cancelable
67+
- Added `iconRef` property. This can be used to get a reference to the displayed expand/collapsed indicator. Returns `null` if `iconPosition` is set to `NONE`.
6068

6169
## 10.1.0
6270

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

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { DisplayDensity } from '../core/density';
1919
import { AbsoluteScrollStrategy, ConnectedPositioningStrategy } from '../services/public_api';
2020
import { IgxSelectionAPIService } from '../core/selection';
2121
import { IgxIconService } from '../icon/public_api';
22-
import { CancelableEventArgs } from '../core/utils';
2322

2423
const CSS_CLASS_COMBO = 'igx-combo';
2524
const CSS_CLASS_COMBO_DROPDOWN = 'igx-combo__drop-down';
@@ -602,6 +601,38 @@ describe('igxCombo', () => {
602601
expect(combo.onSearchInput.emit).toHaveBeenCalledTimes(1);
603602
expect(matchSpy).toHaveBeenCalledTimes(1);
604603
});
604+
it('should not open on click if combo is disabled', () => {
605+
combo = new IgxComboComponent(elementRef, mockCdr, mockSelection as any, mockComboService,
606+
mockIconService, null, null, mockInjector);
607+
const dropdown = jasmine.createSpyObj('IgxComboDropDownComponent', ['open', 'close', 'toggle']);
608+
const spyObj = jasmine.createSpyObj('event', ['stopPropagation', 'preventDefault']);
609+
spyOn(mockIconService, 'addSvgIconFromText').and.returnValue(null);
610+
combo.ngOnInit();
611+
combo.dropdown = dropdown;
612+
dropdown.collapsed = true;
613+
614+
combo.disabled = true;
615+
combo.onInputClick(spyObj);
616+
expect(combo.dropdown.collapsed).toBeTruthy();
617+
});
618+
it('should not clear value when combo is disabled', () => {
619+
const selectionService = new IgxSelectionAPIService();
620+
combo = new IgxComboComponent(elementRef, mockCdr, selectionService, mockComboService,
621+
mockIconService, null, null, mockInjector);
622+
const dropdown = jasmine.createSpyObj('IgxComboDropDownComponent', ['selectItem']);
623+
const spyObj = jasmine.createSpyObj('event', ['stopPropagation']);
624+
spyOn(mockIconService, 'addSvgIconFromText').and.returnValue(null);
625+
combo.ngOnInit();
626+
combo.data = data;
627+
combo.dropdown = dropdown;
628+
combo.disabled = true;
629+
spyOnProperty(combo, 'totalItemCount').and.returnValue(combo.data.length);
630+
631+
const item = combo.data.slice(0, 1);
632+
combo.selectItems(item, true);
633+
combo.handleClearItems(spyObj);
634+
expect(combo.value).toEqual(item[0]);
635+
});
605636
});
606637
describe('Initialization and rendering tests: ', () => {
607638
configureTestSuite();
@@ -2541,13 +2572,6 @@ describe('igxCombo', () => {
25412572
expect(combo.valid).toEqual(IgxComboState.INITIAL);
25422573
expect(combo.comboInput.valid).toEqual(IgxInputState.INITIAL);
25432574
});
2544-
it('should not open on click if combo is disabled', () => {
2545-
combo.disabled = true;
2546-
fixture.detectChanges();
2547-
UIInteractions.simulateClickEvent(combo.comboInput.nativeElement);
2548-
fixture.detectChanges();
2549-
expect(combo.dropdown.collapsed).toBeTruthy();
2550-
});
25512575
it('should be possible to be enabled/disabled when used as a form control', () => {
25522576
const form = fixture.componentInstance.reactiveForm;
25532577
const comboFormReference = form.controls.townCombo;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,9 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
13241324
* @hidden @internal
13251325
*/
13261326
public handleClearItems(event: Event): void {
1327+
if (this.disabled) {
1328+
return;
1329+
}
13271330
this.deselectAllItems(true, event);
13281331
if (this.collapsed) {
13291332
this.getEditElement().focus();

projects/igniteui-angular/src/lib/core/styles/components/action-strip/_action-strip-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/// @author <a href="https://github.com/simeonoff" target="_blank">Simeon Simeonoff</a>
55
/// @author <a href="https://github.com/desig9stein" target="_blank">Marin Popov</a>
66
////
7-
///
7+
88
/// If only background color is specified, text/icon color will be assigned automatically to a contrasting color.
99
/// @param {Map} $palette [$default-palette] - The palette used as basis for styling the component.
1010
/// @param {Map} $schema [$light-schema] - The schema used as basis for styling the component.

projects/igniteui-angular/src/lib/core/styles/components/navdrawer/_navdrawer-component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,8 @@
8484
@include e(item, header) {
8585
@extend %item--header !optional;
8686
}
87+
88+
@include m(disable-animation) {
89+
@extend %disable-animation !optional;
90+
}
8791
}

projects/igniteui-angular/src/lib/core/styles/components/navdrawer/_navdrawer-theme.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,10 @@
434434
transition: none;
435435
visibility: hidden;
436436
}
437+
438+
%disable-animation {
439+
transition-duration: 0s;
440+
}
437441
}
438442

439443
/// Adds typography styles for the igx-navdrawer component.

projects/igniteui-angular/src/lib/core/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export const NAVIGATION_KEYS = new Set([
324324
]);
325325
export const ROW_EXPAND_KEYS = new Set('right down arrowright arrowdown'.split(' '));
326326
export const ROW_COLLAPSE_KEYS = new Set('left up arrowleft arrowup'.split(' '));
327-
export const SUPPORTED_KEYS = new Set([...Array.from(NAVIGATION_KEYS), 'enter', 'f2', 'escape', 'esc', 'pagedown', 'pageup']);
327+
export const SUPPORTED_KEYS = new Set([...Array.from(NAVIGATION_KEYS), 'enter', 'f2', 'escape', 'esc', 'pagedown', 'pageup', '+']);
328328
export const HEADER_KEYS = new Set([...Array.from(NAVIGATION_KEYS), 'escape', 'esc' , 'l']);
329329

330330
/**

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

Lines changed: 4 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
@@ -81,14 +81,15 @@ The following inputs are available in the **igx-expansion-panel-header** compone
8181
| `role` | `string` | The `role` attribute of the header |
8282
| `iconPosition` | `string` | The position of the expand/collapse icon of the header |
8383
| `disabled` | `boolean` | Gets/sets whether the panel header is disabled (blocking user interaction) or not |
84+
| `iconRef` | `ElementRef` | Gets the reference to the element being used as expand/collapse indicator. If `iconPosition` is `NONE` - return `null` |
8485

8586

8687
### Outputs
8788
The following outputs are available in the **igx-expansion-panel-header** component:
8889

8990
| Name | Cancelable | Description | Parameters
9091
| :--- | :--- | :--- | :--- |
91-
| `onInteraction` | `false` | Emitted when a user interacts with the header host | `{ event: Event, panel: IgxExpansionPanelComponent }` |
92+
| `onInteraction` | `true` | Emitted when a user interacts with the header host | `IExpansionPanelCancelableEventArgs` |
9293

9394
## IgxExpansionPanelBodyComponent
9495
### Inputs

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

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ import {
99
EventEmitter,
1010
Output,
1111
ContentChild,
12-
Inject
12+
Inject,
13+
ViewChild
1314
} from '@angular/core';
1415
import { IgxExpansionPanelIconDirective } from './expansion-panel.directives';
15-
import { IExpansionPanelEventArgs, IGX_EXPANSION_PANEL_COMPONENT, IgxExpansionPanelBase } from './expansion-panel.common';
16+
import { IGX_EXPANSION_PANEL_COMPONENT, IgxExpansionPanelBase, IExpansionPanelCancelableEventArgs } from './expansion-panel.common';
1617
import { mkenum } from '../core/utils';
18+
import { IgxIconComponent } from '../icon/public_api';
1719

1820
/**
1921
* @hidden
@@ -42,6 +44,23 @@ export class IgxExpansionPanelHeaderComponent {
4244
*/
4345
public id = '';
4446

47+
/** @hidden @internal */
48+
@ContentChild(IgxExpansionPanelIconDirective, { read: ElementRef })
49+
private customIconRef: ElementRef;
50+
51+
/** @hidden @internal */
52+
@ViewChild(IgxIconComponent, { read: ElementRef })
53+
public defaultIconRef: ElementRef;
54+
55+
/**
56+
* Returns a reference to the `igx-expansion-panel-icon` element;
57+
* If `iconPosition` is `NONE` - return null;
58+
*/
59+
public get iconRef(): ElementRef {
60+
const renderedTemplate = this.customIconRef ?? this.defaultIconRef;
61+
return this.iconPosition !== ICON_POSITION.NONE ? renderedTemplate : null;
62+
}
63+
4564
/**
4665
* @hidden
4766
*/
@@ -120,7 +139,7 @@ export class IgxExpansionPanelHeaderComponent {
120139
/**
121140
* Emitted whenever a user interacts with the header host
122141
* ```typescript
123-
* handleInteraction(event: IExpansionPanelEventArgs) {
142+
* handleInteraction(event: IExpansionPanelCancelableEventArgs) {
124143
* ...
125144
* }
126145
* ```
@@ -131,7 +150,7 @@ export class IgxExpansionPanelHeaderComponent {
131150
* ```
132151
*/
133152
@Output()
134-
public onInteraction = new EventEmitter<IExpansionPanelEventArgs>();
153+
public onInteraction = new EventEmitter<IExpansionPanelCancelableEventArgs >();
135154

136155
/**
137156
* @hidden
@@ -185,7 +204,11 @@ export class IgxExpansionPanelHeaderComponent {
185204
evt.stopPropagation();
186205
return;
187206
}
188-
this.onInteraction.emit({ event: evt, panel: this.panel });
207+
const eventArgs: IExpansionPanelCancelableEventArgs = { event: evt, panel: this.panel, owner: this.panel, cancel: false };
208+
this.onInteraction.emit(eventArgs);
209+
if (eventArgs.cancel === true) {
210+
return;
211+
}
189212
this.panel.toggle(evt);
190213
evt.preventDefault();
191214
}
@@ -194,17 +217,25 @@ export class IgxExpansionPanelHeaderComponent {
194217
@HostListener('keydown.Alt.ArrowDown', ['$event'])
195218
public openPanel(event: KeyboardEvent) {
196219
if (event.altKey) {
220+
const eventArgs: IExpansionPanelCancelableEventArgs = { event, panel: this.panel, owner: this.panel, cancel: false };
221+
this.onInteraction.emit(eventArgs);
222+
if (eventArgs.cancel === true) {
223+
return;
224+
}
197225
this.panel.expand(event);
198-
this.onInteraction.emit({ event: event, panel: this.panel });
199226
}
200227
}
201228

202229
/** @hidden @internal */
203230
@HostListener('keydown.Alt.ArrowUp', ['$event'])
204231
public closePanel(event: KeyboardEvent) {
205232
if (event.altKey) {
233+
const eventArgs: IExpansionPanelCancelableEventArgs = { event, panel: this.panel, owner: this.panel, cancel: false };
234+
this.onInteraction.emit(eventArgs);
235+
if (eventArgs.cancel === true) {
236+
return;
237+
}
206238
this.panel.collapse(event);
207-
this.onInteraction.emit({ event: event, panel: this.panel });
208239
}
209240
}
210241

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EventEmitter, InjectionToken } from '@angular/core';
22
import { AnimationReferenceMetadata } from '@angular/animations';
3-
import { IBaseEventArgs } from '../core/utils';
3+
import { CancelableEventArgs, IBaseEventArgs } from '../core/utils';
44

55
export interface IgxExpansionPanelBase {
66
id: string;
@@ -21,5 +21,11 @@ export const IGX_EXPANSION_PANEL_COMPONENT = new InjectionToken<IgxExpansionPane
2121

2222
export interface IExpansionPanelEventArgs extends IBaseEventArgs {
2323
event: Event;
24-
panel: IgxExpansionPanelBase;
24+
/**
25+
* @deprecated
26+
* To get a reference to the panel, use `owner` instead.
27+
*/
28+
panel?: IgxExpansionPanelBase;
2529
}
30+
31+
export interface IExpansionPanelCancelableEventArgs extends IExpansionPanelEventArgs, CancelableEventArgs {}

0 commit comments

Comments
 (0)