Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: IgniteUI/igniteui-angular
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 14.0.12
Choose a base ref
...
head repository: IgniteUI/igniteui-angular
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 14.0.13
Choose a head ref
  • 10 commits
  • 6 files changed
  • 7 contributors

Commits on Jul 28, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c4ccc39 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    crazy-max CrazyMax
    Copy the full SHA
    278e231 View commit details

Commits on Aug 3, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c4ba982 View commit details

Commits on Aug 8, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e020597 View commit details
  2. Copy the full SHA
    0406a66 View commit details

Commits on Aug 9, 2022

  1. Merge pull request #11916 from IgniteUI/vkombov/fix-11539-14.0.x

    fix(grid): Emit the rangeSelected event when pointerup is fired outside the Grid's cells - 14.0.x
    kdinev authored Aug 9, 2022
    Copy the full SHA
    50c0712 View commit details
  2. Copy the full SHA
    4893e20 View commit details

Commits on Aug 10, 2022

  1. Merge pull request #11962 from IgniteUI/vkombov/fix-11955-14.0.x

    fix(grid): Prevent drag selection when is initiated outside the grid - 14.0.x
    kdinev authored Aug 10, 2022
    Copy the full SHA
    a8515f7 View commit details

Commits on Aug 12, 2022

  1. fix(*): activate correct node when grid loses focus and regain it #11395

     (#11705)
    
    Co-authored-by: Hristo <hanastasov@infragistics.com>
    ddincheva and hanastasov authored Aug 12, 2022
    Copy the full SHA
    f4e6ea8 View commit details

Commits on Aug 16, 2022

  1. fix(radio): allowing radio group to pick dynamically added radios - 1…

    …4.0 (#11958)
    
    * fix(radio): allowing radio group to pick dynamically added radios #11849 #11942
    
    Co-authored-by: Deyan Kamburov <dkamburov@users.noreply.github.com>
    ChronosSF and dkamburov authored Aug 16, 2022
    Copy the full SHA
    ea89a91 View commit details
Original file line number Diff line number Diff line change
@@ -195,6 +195,24 @@ describe('IgxRadioGroupDirective', () => {
expect(radioGroup.radioButtons.first.checked).toEqual(true);
}));

it('Properly rebind dynamically added components', fakeAsync(() => {
const fixture = TestBed.createComponent(RadioGroupDeepProjectionComponent);
const radioInstance = fixture.componentInstance.radioGroup;
fixture.detectChanges();
tick();

fixture.componentInstance.choices = [ 0, 1, 4, 7 ];
fixture.detectChanges();
tick();

radioInstance.radioButtons.last.nativeLabel.nativeElement.click();
fixture.detectChanges();
tick();

expect(radioInstance.value).toEqual(7);
expect(radioInstance.selected).toEqual(radioInstance.radioButtons.last);
}));

it('Updates checked radio button correctly', fakeAsync(() => {
const fixture = TestBed.createComponent(RadioGroupSimpleComponent);
fixture.detectChanges();
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import {
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { noop, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { startWith, takeUntil } from 'rxjs/operators';
import { mkenum } from '../../core/utils';
import { IChangeRadioEventArgs, IgxRadioComponent, RadioLabelPosition } from '../../radio/radio.component';
import { IgxRippleModule } from '../ripple/ripple.directive';
@@ -291,6 +291,11 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
* @internal
*/
private destroy$ = new Subject<boolean>();
/**
* @hidden
* @internal
*/
private queryChange$ = new Subject();

/**
* @hidden
@@ -301,8 +306,9 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
// the OnInit of the NgModel occurs after the OnInit of this class.
this._isInitialized = true;

setTimeout(() => {
this._initRadioButtons();
this.radioButtons.changes.pipe(startWith(0), takeUntil(this.destroy$)).subscribe(() => {
this.queryChange$.next();
setTimeout(() => this._initRadioButtons());
});
}

@@ -390,7 +396,11 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
this._selected = button;
}

button.change.pipe(takeUntil(this.destroy$)).subscribe((ev) => this._selectedRadioButtonChanged(ev));
button.change.pipe(
takeUntil(button.destroy$),
takeUntil(this.destroy$),
takeUntil(this.queryChange$)
).subscribe((ev) => this._selectedRadioButtonChanged(ev));
});
}
}
Original file line number Diff line number Diff line change
@@ -144,8 +144,12 @@ export class IgxGridNavigationService {
if (shouldClearSelection || (this.grid.cellSelection !== GridSelectionMode.multiple)) {
this.grid.clearCellSelection();
this.grid.navigateTo(this.activeNode.row, this.activeNode.column, (obj) => {
obj.target?.activate(event);
this.grid.cdr.detectChanges();
if(this.activeNode.row === obj.target.row.index) {
obj.target?.activate(event);
this.grid.cdr.detectChanges();
} else {
this.grid.navigateTo(this.activeNode.row, this.activeNode.column);
}
});
} else {
const range = {
Original file line number Diff line number Diff line change
@@ -461,11 +461,13 @@ describe('IgxGrid - Cell selection #grid', () => {
describe('API', () => {
let fix;
let grid;
let detect;

beforeEach(fakeAsync(/** height/width setter rAF */() => {
fix = TestBed.createComponent(SelectionWithScrollsComponent);
fix.detectChanges();
grid = fix.componentInstance.grid;
detect = () => grid.cdr.detectChanges();
}));

it('Should select a single cell', () => {
@@ -858,6 +860,60 @@ describe('IgxGrid - Cell selection #grid', () => {
expect(selectedData[0]).toEqual({ Name: 'Monica Reyes' });
expect(selectedData[1]).toEqual({ ID: 957 });
});

it('rangeSelected event should be emitted when pointer leaves active state outside grid\'s cells', () => {
const selectionChangeSpy = spyOn<any>(grid.rangeSelected, 'emit').and.callThrough();
const startCell = grid.gridAPI.get_cell_by_index(2, 'ParentID');
const range = { rowStart: 2, rowEnd: 3, columnStart: 0, columnEnd: 1 };

UIInteractions.simulatePointerOverElementEvent('pointerdown', startCell.nativeElement);
detect();

expect(startCell.active).toBe(true);

for (let i = 3; i < 5; i++) {
const cell = grid.gridAPI.get_cell_by_index(i, grid.columnList.get(i - 1).field);
UIInteractions.simulatePointerOverElementEvent('pointerenter', cell.nativeElement);
}

for (let i = 3; i >= 0; i--) {
const cell = grid.gridAPI.get_cell_by_index(i, 'HireDate');
UIInteractions.simulatePointerOverElementEvent('pointerenter', cell.nativeElement);
}

for (let i = 2; i >= 0; i--) {
const cell = grid.gridAPI.get_cell_by_index(0, grid.columnList.get(i).field);
UIInteractions.simulatePointerOverElementEvent('pointerenter', cell.nativeElement);
}

for (let i = 1; i < 4; i++) {
const cell = grid.gridAPI.get_cell_by_index(i, 'ID');
UIInteractions.simulatePointerOverElementEvent('pointerenter', cell.nativeElement);
}

UIInteractions.simulatePointerOverElementEvent('pointerup', document.body);
detect();

expect(selectionChangeSpy).toHaveBeenCalledTimes(1);
expect(selectionChangeSpy).toHaveBeenCalledWith(range);
});

it('Should not throw an error when trying to do a drag selection that is started outside the grid', fakeAsync(() => {
let cell = grid.gridAPI.get_cell_by_index(1, 'ParentID');

UIInteractions.simulatePointerOverElementEvent('pointerdown', document.body);
tick();
fix.detectChanges();

UIInteractions.simulatePointerOverElementEvent('pointerenter', cell.nativeElement);
UIInteractions.simulatePointerOverElementEvent('pointerup', cell.nativeElement);
tick();
fix.detectChanges();

expect(() => {
fix.detectChanges();
}).not.toThrow();
}));
});

describe('Keyboard navigation', () => {
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@ export class IgxGridSelectionService {
private pointerEventInGridBody = false;

private allRowsSelected: boolean;
private _lastSelectedNode: ISelectionNode;
private _ranges: Set<string> = new Set<string>();
private _selectionRange: Range;

@@ -179,6 +180,8 @@ export class IgxGridSelectionService {
* and the start node of the `state`.
*/
public generateRange(node: ISelectionNode, state?: SelectionState): GridSelectionRange {
this._lastSelectedNode = node;

if (!state) {
return {
rowStart: node.row,
@@ -311,8 +314,8 @@ export class IgxGridSelectionService {
return true;
}

public pointerUp(node: ISelectionNode, emitter: EventEmitter<GridSelectionRange>): boolean {
if (this.dragMode) {
public pointerUp(node: ISelectionNode, emitter: EventEmitter<GridSelectionRange>, firedOutsideGrid?: boolean): boolean {
if (this.dragMode || firedOutsideGrid) {
this.restoreTextSelection();
this.addRangeMeta(node, this.pointerState);
this.mergeMap(this.selection, this.temp);
@@ -751,8 +754,13 @@ export class IgxGridSelectionService {
return this.grid.gridAPI.row_deleted_transaction(rowID);
}

private pointerOriginHandler = () => {
private pointerOriginHandler = (event) => {
this.pointerEventInGridBody = false;
document.body.removeEventListener('pointerup', this.pointerOriginHandler);

const targetTagName = event.target.tagName.toLowerCase();
if (targetTagName !== 'igx-grid-cell' && targetTagName !== 'igx-tree-grid-cell') {
this.pointerUp(this._lastSelectedNode, this.grid.rangeSelected, true);
}
};
}
21 changes: 19 additions & 2 deletions projects/igniteui-angular/src/lib/radio/radio.component.ts
Original file line number Diff line number Diff line change
@@ -3,11 +3,12 @@ import {
HostBinding,
HostListener,
Input,
OnDestroy,
Output,
ViewChild
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { noop } from 'rxjs';
import { noop, Subject } from 'rxjs';
import { EditorProvider } from '../core/edit-provider';
import { IBaseEventArgs, mkenum } from '../core/utils';

@@ -47,9 +48,16 @@ let nextId = 0;
selector: 'igx-radio',
templateUrl: 'radio.component.html'
})
export class IgxRadioComponent implements ControlValueAccessor, EditorProvider {
export class IgxRadioComponent implements ControlValueAccessor, EditorProvider, OnDestroy {
private static ngAcceptInputType_required: boolean | '';
private static ngAcceptInputType_disabled: boolean | '';

/**
* @hidden
* @internal
*/
public destroy$ = new Subject<boolean>();

/**
* Returns reference to native radio element.
* ```typescript
@@ -333,6 +341,15 @@ export class IgxRadioComponent implements ControlValueAccessor, EditorProvider {

constructor(private cdr: ChangeDetectorRef) { }

/**
* @hidden
* @internal
*/
public ngOnDestroy(): void {
this.destroy$.next(true);
this.destroy$.complete();
}

/**
* @hidden
* @internal