Skip to content

Commit 86dbfeb

Browse files
committed
feat(drp): open on click of input in dialog mode for two inputs also
1 parent 7b61afc commit 86dbfeb

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,6 +1434,16 @@ describe('IgxDateRangePicker', () => {
14341434
expect(fixture.componentInstance.dateRange.collapsed).toBeFalsy();
14351435
}));
14361436

1437+
it('should expand the calendar if any of the inputs is clicked in dialog mode', fakeAsync(() => {
1438+
fixture.componentInstance.mode = PickerInteractionMode.Dialog;
1439+
fixture.detectChanges();
1440+
endInput = fixture.debugElement.queryAll(By.css(CSS_CLASS_INPUT))[1];
1441+
endInput.nativeElement.dispatchEvent(new Event('click'));
1442+
fixture.detectChanges();
1443+
tick();
1444+
expect(fixture.componentInstance.dateRange.collapsed).toBeFalsy();
1445+
}));
1446+
14371447
it('should not expand the calendar if the default icon is clicked when disabled is set to true', fakeAsync(() => {
14381448
fixture.componentInstance.disabled = true;
14391449
fixture.detectChanges();

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -984,17 +984,18 @@ export class IgxDateRangePickerComponent extends PickerBaseDirective
984984
}
985985

986986
private subscribeToClick() {
987-
const editElement = this.getEditElement();
988-
if (!editElement) {
989-
return;
990-
}
991-
fromEvent(editElement, 'click')
992-
.pipe(takeUntil(this._destroy$))
993-
.subscribe(() => {
994-
if (!this.isDropdown) {
995-
this.toggle();
996-
}
997-
});
987+
const inputs = this.hasProjectedInputs
988+
? this.projectedInputs.map(i => i.inputDirective.nativeElement)
989+
: [this.getEditElement()];
990+
inputs.forEach(input => {
991+
fromEvent(input, 'click')
992+
.pipe(takeUntil(this._destroy$))
993+
.subscribe(() => {
994+
if (!this.isDropdown) {
995+
this.toggle();
996+
}
997+
});
998+
});
998999
}
9991000

10001001
private subscribeToDateEditorEvents(): void {

0 commit comments

Comments
 (0)