Skip to content

Commit c92e20d

Browse files
authored
Merge branch 'master' into simeonoff/indigo-theme
2 parents f22cc83 + b9aa66a commit c92e20d

File tree

12 files changed

+214
-145
lines changed

12 files changed

+214
-145
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ All notable changes for each version of this project will be documented in this
77
### General
88
- `igxCombo`
99
- **Behavioral Change** - Change default positioning strategy from `ConnectedPositioningStrategy` to `AutoPositionStrategy`. The [`Auto`](https://www.infragistics.com/products/ignite-ui-angular/angular/components/overlay_position.html#auto) strategy will initially try to show the element like the Connected strategy does. If the element goes out of the viewport Auto will flip the starting point and the direction, i.e. if the direction is 'bottom', it will switch it to 'top' and so on. If after flipping direction the content goes out of the view, auto strategy will revert to initial start point and direction and will push the content into the view. Note after pushing the content it may hide the combo's input.
10+
- Make `onSearchInput` event cancellable. The event args type has been changed to `IComboSearchInputEventArgs`, which have the following properties: `searchText` - holds the text typed into the search input, `owner` - holds a reference to the combo component and `cancel` - indicates whether the event should be canceled.
1011
- `IgxOverlay`
11-
- Added new property - `closeOnEsc` - in `OverlaySettings`. The overlay can now be prevented from closing, on escape keypress, by setting the property to `false`, by default it's `true`.
12+
- Added new property `closeOnEscape` in `OverlaySettings` that controls whether the overlay should close on escape keypress. By default `closeOnEsc` is set to `false`.
13+
- **Behavioral Change** - `modal` overlays shown directly through the Overlay Service no longer close on Escape by default. That behavior can now be specified using the `closeOnEscape` property.
1214
- `igxDialog`
13-
- Added `closeOnEscapeKey` - with it, the dialog can be allowed or prevented from closing when `Esc` is pressed.
15+
- Added `closeOnEscape` - with it, the dialog can be allowed or prevented from closing when `Esc` is pressed.
1416
- `IgxNavbar`:
1517
- **Breaking Changes** - The `igx-action-icon` has been renamed to `igx-navbar-action`. It should get renamed in your components via `ng update`;
1618
- `igxGrid`
@@ -19,6 +21,8 @@ All notable changes for each version of this project will be documented in this
1921
- Removed `onDataPreLoad` event as it is specific for remote virtualization implementation, which is not supported for the `igxTreeGrid`. A more generic `onScroll` event is exposed and can be used instead.
2022
- `IgxTimePicker`
2123
- Added a disabled style for time parts outside of the minimum and maximum range.
24+
- `igxDatePicker`
25+
- Added new property - `editorTabIndex`, that allows setting tabindex for the default editor.
2226

2327
### New Theme
2428
Ignite UI for Angular now has a new theme based on our own design system.

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

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { configureTestSuite } from '../test-utils/configure-suite';
1818
import { DisplayDensity } from '../core/density';
1919
import { AbsoluteScrollStrategy, ConnectedPositioningStrategy } from '../services/public_api';
2020
import { IgxSelectionAPIService } from '../core/selection';
21+
import { CancelableEventArgs } from '../core/utils';
2122

2223
const CSS_CLASS_COMBO = 'igx-combo';
2324
const CSS_CLASS_COMBO_DROPDOWN = 'igx-combo__drop-down';
@@ -530,21 +531,42 @@ describe('igxCombo', () => {
530531
expect(matchSpy).toHaveBeenCalledTimes(1);
531532
expect(combo.onSearchInput.emit).toHaveBeenCalledTimes(0);
532533

534+
const args = {
535+
searchText: 'Fake',
536+
owner: combo,
537+
cancel: false
538+
};
533539
combo.handleInputChange('Fake');
534540
expect(matchSpy).toHaveBeenCalledTimes(2);
535541
expect(combo.onSearchInput.emit).toHaveBeenCalledTimes(1);
536-
expect(combo.onSearchInput.emit).toHaveBeenCalledWith('Fake');
542+
expect(combo.onSearchInput.emit).toHaveBeenCalledWith(args);
537543

544+
args.searchText = '';
538545
combo.handleInputChange('');
539546
expect(matchSpy).toHaveBeenCalledTimes(3);
540547
expect(combo.onSearchInput.emit).toHaveBeenCalledTimes(2);
541-
expect(combo.onSearchInput.emit).toHaveBeenCalledWith('');
548+
expect(combo.onSearchInput.emit).toHaveBeenCalledWith(args);
542549

543550
combo.filterable = false;
544551
combo.handleInputChange();
545552
expect(matchSpy).toHaveBeenCalledTimes(4);
546553
expect(combo.onSearchInput.emit).toHaveBeenCalledTimes(2);
547554
});
555+
it('should be able to cancel onSearchInput', () => {
556+
combo = new IgxComboComponent({ nativeElement: null }, mockCdr, mockSelection as any, mockComboService, null, mockInjector);
557+
combo.ngOnInit();
558+
combo.data = data;
559+
combo.filterable = true;
560+
combo.onSearchInput.subscribe((e) => {
561+
e.cancel = true;
562+
});
563+
const matchSpy = spyOn<any>(combo, 'checkMatch').and.callThrough();
564+
spyOn(combo.onSearchInput, 'emit').and.callThrough();
565+
566+
combo.handleInputChange('Item1');
567+
expect(combo.onSearchInput.emit).toHaveBeenCalledTimes(1);
568+
expect(matchSpy).toHaveBeenCalledTimes(0);
569+
});
548570
});
549571
describe('Initialization and rendering tests: ', () => {
550572
configureTestSuite();

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

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ export interface IComboSelectionChangeEventArgs extends CancelableEventArgs, IBa
9696
event?: Event;
9797
}
9898

99+
/** Event emitted when the igx-combo's search input changes */
100+
export interface IComboSearchInputEventArgs extends CancelableEventArgs, IBaseEventArgs {
101+
/** The text that has been typed into the search input */
102+
searchText: string;
103+
}
104+
99105
export interface IComboItemAdditionEvent extends IBaseEventArgs {
100106
oldCollection: any[];
101107
addedItem: any;
@@ -483,7 +489,7 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
483489
* ```
484490
*/
485491
@Output()
486-
public onSearchInput = new EventEmitter();
492+
public onSearchInput = new EventEmitter<IComboSearchInputEventArgs>();
487493

488494
/**
489495
* Emitted when new chunk of data is loaded from the virtualization
@@ -981,7 +987,16 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
981987
*/
982988
public handleInputChange(event?: string) {
983989
if (event !== undefined) {
984-
this.onSearchInput.emit(event);
990+
const args: IComboSearchInputEventArgs = {
991+
searchText: event,
992+
owner: this,
993+
cancel: false
994+
};
995+
this.onSearchInput.emit(args);
996+
if (args.cancel) {
997+
this.searchValue = null;
998+
return;
999+
}
9851000
}
9861001
this.checkMatch();
9871002
}
@@ -1436,8 +1451,8 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
14361451
/** Returns a string that should be populated in the combo's text box */
14371452
private concatDisplayText(selection: any[]): string {
14381453
const value = this.displayKey !== null && this.displayKey !== undefined ?
1439-
this.convertKeysToItems(selection).map(entry => entry[this.displayKey]).join(', ') :
1440-
selection.join(', ');
1454+
this.convertKeysToItems(selection).map(entry => entry[this.displayKey]).join(', ') :
1455+
selection.join(', ');
14411456
return value;
14421457
}
14431458

projects/igniteui-angular/src/lib/date-picker/date-picker.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
[value]="displayData || ''"
1111
[disabled]="disabled"
1212
(blur)="onBlur($event)"
13+
[tabindex]='editorTabIndex'
1314
readonly
1415
/>
1516
</igx-input-group>
@@ -36,6 +37,7 @@
3637
(wheel)="onWheel($event)"
3738
(input)="onInput($event)"
3839
(focus)="onFocus()"
40+
[tabindex]='editorTabIndex'
3941
/>
4042
<igx-suffix *ngIf="!isEmpty" (click)="clear()">
4143
<igx-icon>clear</igx-icon>

projects/igniteui-angular/src/lib/date-picker/date-picker.component.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ describe('IgxDatePicker', () => {
277277
expect(input).toEqual(document.activeElement);
278278
}));
279279

280+
it('should allow setting editorTabIndex', () => {
281+
fixture.componentInstance.datePicker.editorTabIndex = 3;
282+
fixture.detectChanges();
283+
const input = fixture.debugElement.query(By.directive(IgxInputDirective)).nativeElement;
284+
expect(input.tabIndex).toBe(3);
285+
});
286+
280287
});
281288

282289
describe('DatePicker with passed date', () => {

projects/igniteui-angular/src/lib/date-picker/date-picker.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,15 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
177177
*/
178178
@Input() public locale: 'en';
179179

180+
/**
181+
* Gets/Sets the default template editor's tabindex.
182+
* @example
183+
* ```html
184+
* <igx-date-picker editorTabIndex="1"></igx-date-picker>
185+
* ```
186+
*/
187+
@Input() public editorTabIndex: number;
188+
180189
/**
181190
* Gets/Sets on which day the week starts.
182191
* @example
@@ -783,8 +792,8 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
783792

784793
this._modalOverlaySettings = {
785794
closeOnOutsideClick: true,
786-
closeOnEsc: true,
787795
modal: true,
796+
closeOnEscape: true,
788797
outlet: this.outlet
789798
};
790799

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

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,36 @@ export class IgxDialogComponent implements IToggleView, OnInit, OnDestroy, After
7373
@Input()
7474
public id = `igx-dialog-${DIALOG_ID++}`;
7575

76+
/**
77+
* Controls whether the dialog should be shown as modal. Defaults to `true`
78+
* ```html
79+
* <igx-dialog [isModal]="false" ></igx-dialog>
80+
* ```
81+
*/
7682
@Input()
77-
get isModal() {
83+
public get isModal() {
7884
return this._isModal;
7985
}
8086

81-
set isModal(val: boolean) {
87+
public set isModal(val: boolean) {
8288
this._overlayDefaultSettings.modal = val;
8389
this._isModal = val;
8490
}
8591

86-
get closeOnEscapeKey() {
87-
return this._closeOnEscapeKey;
92+
/**
93+
* Controls whether the dialog should close when `Esc` key is pressed. Defaults to `true`
94+
* ```html
95+
* <igx-dialog [closeOnEscape]="false" ></igx-dialog>
96+
* ```
97+
*/
98+
@Input()
99+
public get closeOnEscape() {
100+
return this._closeOnEscape;
88101
}
89102

90-
set closeOnEscapeKey(val: boolean) {
91-
this._overlayDefaultSettings.closeOnEsc = val;
92-
this._closeOnEscapeKey = val;
103+
public set closeOnEscape(val: boolean) {
104+
this._overlayDefaultSettings.closeOnEscape = val;
105+
this._closeOnEscape = val;
93106
}
94107

95108
/**
@@ -310,7 +323,7 @@ export class IgxDialogComponent implements IToggleView, OnInit, OnDestroy, After
310323

311324
private _overlayDefaultSettings: OverlaySettings;
312325
private _closeOnOutsideSelect = false;
313-
private _closeOnEscapeKey = true;
326+
private _closeOnEscape = true;
314327
private _isModal = true;
315328
protected destroy$ = new Subject<boolean>();
316329

@@ -414,7 +427,7 @@ export class IgxDialogComponent implements IToggleView, OnInit, OnDestroy, After
414427
positionStrategy: new GlobalPositionStrategy(this._positionSettings),
415428
scrollStrategy: new NoOpScrollStrategy(),
416429
modal: this.isModal,
417-
closeOnEsc: this._closeOnEscapeKey,
430+
closeOnEscape: this._closeOnEscape,
418431
closeOnOutsideClick: this.closeOnOutsideSelect
419432
};
420433
}

projects/igniteui-angular/src/lib/directives/toggle/toggle.directive.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ describe('IgxToggle', () => {
475475
positionStrategy: jasmine.any(ConnectedPositioningStrategy) as any,
476476
closeOnOutsideClick: true,
477477
modal: false,
478-
closeOnEsc: true,
479478
scrollStrategy: jasmine.any(AbsoluteScrollStrategy) as any,
480479
excludePositionTarget: true
481480
};
@@ -499,7 +498,6 @@ describe('IgxToggle', () => {
499498
positionStrategy: jasmine.any(ConnectedPositioningStrategy) as any,
500499
closeOnOutsideClick: true,
501500
modal: false,
502-
closeOnEsc: true,
503501
scrollStrategy: jasmine.any(AbsoluteScrollStrategy) as any,
504502
excludePositionTarget: true
505503
};
@@ -535,7 +533,6 @@ describe('IgxToggle', () => {
535533
positionStrategy: jasmine.any(ConnectedPositioningStrategy) as any,
536534
closeOnOutsideClick: true,
537535
modal: false,
538-
closeOnEsc: true,
539536
scrollStrategy: jasmine.any(AbsoluteScrollStrategy) as any,
540537
excludePositionTarget: true
541538
};
@@ -594,7 +591,6 @@ describe('IgxToggle', () => {
594591
positionStrategy: jasmine.any(ConnectedPositioningStrategy) as any,
595592
closeOnOutsideClick: true,
596593
modal: false,
597-
closeOnEsc: true,
598594
scrollStrategy: jasmine.any(AbsoluteScrollStrategy) as any,
599595
outlet: jasmine.any(IgxOverlayOutletDirective) as any,
600596
excludePositionTarget: true

projects/igniteui-angular/src/lib/directives/toggle/toggle.directive.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ export class IgxToggleActionDirective implements OnInit {
429429
scrollStrategy: new AbsoluteScrollStrategy(),
430430
closeOnOutsideClick: true,
431431
modal: false,
432-
closeOnEsc: true,
433432
excludePositionTarget: true
434433
};
435434
}

0 commit comments

Comments
 (0)