Skip to content

Commit d7f30ae

Browse files
authored
Merge branch '18.2.x' into hhristov/fix-simple-combo-tab-focus-18.2
2 parents 2ba1037 + f9afd2a commit d7f30ae

File tree

8 files changed

+70
-22
lines changed

8 files changed

+70
-22
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
[width]="itemsWidth || '100%'" (opening)="handleOpening($event)" (closing)="handleClosing($event)"
3737
(opened)="handleOpened()" (closed)="handleClosed()">
3838
<div class="igx-combo__search" *ngIf="displaySearchInput">
39-
<igx-input-group>
39+
<igx-input-group type="line">
4040
<input igxInput #searchInput name="searchInput" autocomplete="off" type="text"
4141
[(ngModel)]="searchValue" (ngModelChange)="handleInputChange($event)" (keyup)="handleKeyUp($event)"
4242
(keydown)="handleKeyDown($event)" (focus)="dropdown.onBlur($event)" [attr.placeholder]="getSearchPlaceholderText()"

projects/igniteui-angular/src/lib/core/styles/components/icon-button/_icon-button-theme.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@
370370
content: '';
371371
inset: 0;
372372
box-shadow: inset 0 0 0 rem(1px) var-get($outlined-theme, 'border-color');
373-
z-index: -1;
374373
border-radius: inherit;
375374
}
376375

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
Output,
88
Renderer2,
99
booleanAttribute,
10-
AfterContentInit
10+
AfterContentInit,
11+
OnDestroy
1112
} from '@angular/core';
1213
import { mkenum } from '../../core/utils';
1314
import { IBaseEventArgs } from '../../core/utils';
@@ -46,7 +47,7 @@ export type IgxButtonType = typeof IgxButtonType[keyof typeof IgxButtonType];
4647
selector: '[igxButton]',
4748
standalone: true
4849
})
49-
export class IgxButtonDirective extends IgxButtonBaseDirective implements AfterContentInit {
50+
export class IgxButtonDirective extends IgxButtonBaseDirective implements AfterContentInit, OnDestroy {
5051
private static ngAcceptInputType_type: IgxButtonType | '';
5152

5253
/**
@@ -92,6 +93,12 @@ export class IgxButtonDirective extends IgxButtonBaseDirective implements AfterC
9293
*/
9394
private _selected = false;
9495

96+
private emitSelected() {
97+
this.buttonSelected.emit({
98+
button: this
99+
});
100+
}
101+
95102
/**
96103
* Gets or sets whether the button is selected.
97104
* Mainly used in the IgxButtonGroup component and it will have no effect if set separately.
@@ -121,11 +128,11 @@ export class IgxButtonDirective extends IgxButtonBaseDirective implements AfterC
121128
}
122129

123130
public ngAfterContentInit() {
124-
this.nativeElement.addEventListener('click', () => {
125-
this.buttonSelected.emit({
126-
button: this
127-
});
128-
});
131+
this.nativeElement.addEventListener('click', this.emitSelected.bind(this));
132+
}
133+
134+
public ngOnDestroy(): void {
135+
this.nativeElement.removeEventListener('click', this.emitSelected);
129136
}
130137

131138
/**

projects/igniteui-angular/src/lib/grids/common/crud.service.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,12 +684,13 @@ export class IgxGridCRUDService extends IgxRowAddCrudState {
684684
return;
685685
}
686686
this.endEdit(true, event);
687-
688-
if (parentRow != null && this.grid.expansionStates.get(parentRow.key)) {
689-
this.grid.collapseRow(parentRow.key);
687+
// work with copy of original row, since context may change on collapse.
688+
const parentRowCopy = parentRow ? Object.assign(copyDescriptors(parentRow), parentRow) : null;
689+
if (parentRowCopy != null && this.grid.expansionStates.get(parentRowCopy.key)) {
690+
this.grid.collapseRow(parentRowCopy.key);
690691
}
691692

692-
this.createAddRow(parentRow, asChild);
693+
this.createAddRow(parentRowCopy, asChild);
693694

694695
this.grid.transactions.startPending();
695696
if (this.addRowParent.isPinned) {

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-add-row-ui.spec.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { IgxActionStripComponent } from '../../action-strip/public_api';
99
import { IgxTreeGridRowComponent } from './tree-grid-row.component';
1010
import { first } from 'rxjs/operators';
1111
import { IRowDataCancelableEventArgs } from '../public_api';
12+
import { wait } from '../../test-utils/ui-interactions.spec';
1213

1314
describe('IgxTreeGrid - Add Row UI #tGrid', () => {
1415
configureTestSuite();
@@ -216,5 +217,47 @@ describe('IgxTreeGrid - Add Row UI #tGrid', () => {
216217
const addedRow = treeGrid.getRowByKey(newRowId);
217218
expect(addedRow.data[treeGrid.foreignKey]).toBe(2);
218219
});
220+
221+
it('should collapse row when child row adding begins and it added row should go under correct parent.', async() => {
222+
treeGrid.data = [
223+
{ ID: 1, ParentID: -1, Name: 'Casey Houston', JobTitle: 'Vice President', Age: 32 },
224+
{ ID: 2, ParentID: 10, Name: 'Gilberto Todd', JobTitle: 'Director', Age: 41 },
225+
{ ID: 3, ParentID: 10, Name: 'Tanya Bennett', JobTitle: 'Director', Age: 29 },
226+
{ ID: 4, ParentID: 6, Name: 'Jack Simon', JobTitle: 'Software Developer', Age: 33 },
227+
{ ID: 6, ParentID: -1, Name: 'Erma Walsh', JobTitle: 'CEO', Age: 52 },
228+
{ ID: 7, ParentID: 10, Name: 'Debra Morton', JobTitle: 'Associate Software Developer', Age: 35 },
229+
{ ID: 9, ParentID: 10, Name: 'Leslie Hansen', JobTitle: 'Associate Software Developer', Age: 44 },
230+
{ ID: 10, ParentID: -1, Name: 'Eduardo Ramirez', JobTitle: 'Manager', Age: 53 }
231+
];
232+
fix.detectChanges();
233+
treeGrid.collapseAll();
234+
treeGrid.height = "350px";
235+
fix.detectChanges();
236+
const parentRow1 = treeGrid.rowList.toArray()[1] as IgxTreeGridRowComponent;
237+
treeGrid.expandRow(parentRow1.key);
238+
const parentRow2 = treeGrid.rowList.toArray()[3] as IgxTreeGridRowComponent;
239+
treeGrid.expandRow(parentRow2.key);
240+
treeGrid.triggerPipes();
241+
fix.detectChanges();
242+
243+
// scroll bottom
244+
treeGrid.verticalScrollContainer.scrollTo(treeGrid.dataView.length - 1);
245+
await wait(50);
246+
fix.detectChanges();
247+
// start add row
248+
parentRow2.beginAddChild();
249+
fix.detectChanges();
250+
// last row should be add row
251+
const addRow = treeGrid.gridAPI.get_row_by_index(4);
252+
expect(addRow.addRowUI).toBeTrue();
253+
endTransition();
254+
255+
// end edit
256+
treeGrid.gridAPI.crudService.endEdit(true);
257+
fix.detectChanges();
258+
259+
// row should be added under correct parent
260+
expect(treeGrid.data[treeGrid.data.length - 1].ParentID).toBe(10);
261+
});
219262
});
220263
});

projects/igniteui-angular/src/lib/input-group/input-group.component.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { DOCUMENT, NgIf, NgTemplateOutlet, NgClass, NgSwitch, NgSwitchCase, NgSwitchDefault } from '@angular/common';
22
import {
3-
AfterViewInit,
43
ChangeDetectorRef,
54
Component,
65
ContentChild,
@@ -36,7 +35,7 @@ import { IgxTheme, THEME_TOKEN, ThemeToken } from '../services/theme/theme.token
3635
standalone: true,
3736
imports: [NgIf, NgTemplateOutlet, IgxPrefixDirective, IgxButtonDirective, NgClass, IgxSuffixDirective, IgxIconComponent, NgSwitch, NgSwitchCase, NgSwitchDefault]
3837
})
39-
export class IgxInputGroupComponent implements IgxInputGroupBase, AfterViewInit {
38+
export class IgxInputGroupComponent implements IgxInputGroupBase {
4039
/**
4140
* Sets the resource strings.
4241
* By default it uses EN resources.
@@ -220,15 +219,13 @@ export class IgxInputGroupComponent implements IgxInputGroupBase, AfterViewInit
220219
private themeToken: ThemeToken
221220
) {
222221
this._theme = this.themeToken.theme;
223-
224-
const { unsubscribe } = this.themeToken.onChange((theme) => {
222+
const themeChange = this.themeToken.onChange((theme) => {
225223
if (this._theme !== theme) {
226224
this._theme = theme;
227225
this.cdr.detectChanges();
228226
}
229227
});
230-
231-
this._destroyRef.onDestroy(() => unsubscribe);
228+
this._destroyRef.onDestroy(() => themeChange.unsubscribe());
232229
}
233230

234231
/** @hidden */
@@ -456,7 +453,7 @@ export class IgxInputGroupComponent implements IgxInputGroupBase, AfterViewInit
456453
}
457454

458455
/** @hidden @internal */
459-
public ngAfterViewInit() {
456+
public ngAfterContentChecked() {
460457
this.setComponentTheme();
461458
}
462459
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ describe('IgxTimePicker', () => {
192192
});
193193

194194
mockCdr = jasmine.createSpyObj('ChangeDetectorRef', ['detectChanges']);
195-
timePicker = new IgxTimePickerComponent(elementRef, 'en', null, mockInjector, null, mockCdr);
195+
const platformUtil = TestBed.inject(PlatformUtil);
196+
timePicker = new IgxTimePickerComponent(elementRef, 'en', null, mockInjector, platformUtil, mockCdr);
196197
(timePicker as any).dateTimeEditor = mockDateTimeEditorDirective;
197198
(timePicker as any)._inputGroup = mockInputGroup;
198199
(timePicker as any).inputDirective = mockInputDirective;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ export class IgxTimePickerComponent extends PickerBaseDirective
12501250

12511251
private subscribeToToggleDirectiveEvents(): void {
12521252
if (this.toggleRef) {
1253-
if (this._inputGroup) {
1253+
if (this._inputGroup && this.platform.isBrowser) {
12541254
this.toggleRef.element.style.width = this._inputGroup.element.nativeElement.getBoundingClientRect().width + 'px';
12551255
}
12561256

0 commit comments

Comments
 (0)