Skip to content

Commit d775c45

Browse files
authored
Merge branch '9.0.x' into nalipiev/drop-down-shadow
2 parents 1a70154 + 99008a6 commit d775c45

File tree

11 files changed

+701
-711
lines changed

11 files changed

+701
-711
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,22 @@ describe('IgxDatePicker', () => {
128128
expect(inputGroup.nativeElement.classList.contains('igx-input-group--disabled')).toBeTruthy();
129129
});
130130

131+
it('should not be able to toggle & clear when disabled', () => {
132+
const date = new Date();
133+
datePicker.value = date;
134+
datePicker.disabled = true;
135+
fixture.detectChanges();
136+
expect(datePicker.collapsed).toBeTruthy();
137+
138+
datePicker.openDialog();
139+
fixture.detectChanges();
140+
expect(datePicker.collapsed).toBeTruthy();
141+
142+
datePicker.clear();
143+
fixture.detectChanges();
144+
expect(datePicker.value).toEqual(date);
145+
});
146+
131147
it('When labelVisability is set to false the label should not be visible', () => {
132148
let label = fixture.debugElement.query(By.directive(IgxLabelDirective));
133149

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

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { IgxInputGroupModule, IgxInputDirective, IgxInputGroupComponent, IgxInpu
3434
import { Subject, fromEvent, animationFrameScheduler, interval, Subscription } from 'rxjs';
3535
import { filter, takeUntil, throttle } from 'rxjs/operators';
3636
import { IgxOverlayOutletDirective } from '../directives/toggle/toggle.directive';
37-
import { IgxTextSelectionModule} from '../directives/text-selection/text-selection.directive';
37+
import { IgxTextSelectionModule } from '../directives/text-selection/text-selection.directive';
3838
import {
3939
OverlaySettings,
4040
IgxOverlayService,
@@ -145,7 +145,7 @@ const noop = () => { };
145145
`]
146146
})
147147
export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor,
148-
EditorProvider, OnInit, AfterViewInit, OnDestroy, AfterViewChecked {
148+
EditorProvider, OnInit, AfterViewInit, OnDestroy, AfterViewChecked {
149149
/**
150150
* Gets/Sets the `IgxDatePickerComponent` label.
151151
* @remarks
@@ -952,10 +952,10 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
952952
* @param date passed date that has to be set to the calendar.
953953
*/
954954
public selectDate(date: Date): void {
955-
const oldValue = this.value;
955+
const oldValue = this.value;
956956
this.value = date;
957957

958-
this.emitValueChangeEvent(oldValue, this.value );
958+
this.emitValueChangeEvent(oldValue, this.value);
959959
this.onSelection.emit(date);
960960
}
961961

@@ -967,9 +967,9 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
967967
* ```
968968
*/
969969
public deselectDate(): void {
970-
const oldValue = this.value;
970+
const oldValue = this.value;
971971
this.value = null;
972-
this.emitValueChangeEvent(oldValue, this.value );
972+
this.emitValueChangeEvent(oldValue, this.value);
973973
if (this.calendar) {
974974
this.calendar.deselectDate();
975975
}
@@ -984,7 +984,7 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
984984
* ```
985985
*/
986986
public openDialog(target?: HTMLElement): void {
987-
if (!this.collapsed) {
987+
if (!this.collapsed || this.disabled) {
988988
return;
989989
}
990990
switch (this.mode) {
@@ -1031,10 +1031,12 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
10311031
* @hidden @internal
10321032
*/
10331033
public clear(): void {
1034-
this.isEmpty = true;
1035-
this.invalidDate = '';
1036-
this.deselectDate();
1037-
this._setCursorPosition(0);
1034+
if (!this.disabled) {
1035+
this.isEmpty = true;
1036+
this.invalidDate = '';
1037+
this.deselectDate();
1038+
this._setCursorPosition(0);
1039+
}
10381040
}
10391041

10401042
/**
@@ -1052,10 +1054,10 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
10521054
date.setSeconds(this.value.getSeconds());
10531055
date.setMilliseconds(this.value.getMilliseconds());
10541056
}
1055-
const oldValue = this.value;
1057+
const oldValue = this.value;
10561058
this.value = date;
10571059

1058-
this.emitValueChangeEvent(oldValue, this.value );
1060+
this.emitValueChangeEvent(oldValue, this.value);
10591061
this.calendar.viewDate = date;
10601062
this.closeCalendar();
10611063
this.onSelection.emit(date);
@@ -1179,11 +1181,11 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
11791181

11801182
if (this.disabledDates === null
11811183
|| (this.disabledDates !== null && !isDateInRanges(newValue, this.disabledDates))) {
1182-
const oldValue = this.value;
1183-
this.value = newValue;
1184+
const oldValue = this.value;
1185+
this.value = newValue;
11841186

1185-
this.emitValueChangeEvent(oldValue, this.value );
1186-
this.invalidDate = '';
1187+
this.emitValueChangeEvent(oldValue, this.value);
1188+
this.invalidDate = '';
11871189
} else {
11881190
const args: IDatePickerDisabledDateEventArgs = {
11891191
datePicker: this,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class IgxFocusDirective {
6363
*/
6464
trigger() {
6565
if (this.focusState) {
66-
requestAnimationFrame(() => this.nativeElement.focus());
66+
requestAnimationFrame(() => this.nativeElement.focus({ preventScroll: true}));
6767
}
6868
}
6969
}

projects/igniteui-angular/src/lib/grids/columns/column-layout.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ export class IgxColumnLayoutComponent extends IgxColumnGroupComponent implements
100100
this.children.forEach(child => child.hidden = value);
101101
if (this.grid && this.grid.columns && this.grid.columns.length > 0) {
102102
// reset indexes in case columns are hidden/shown runtime
103-
this.grid.columns.filter(x => x.columnGroup).forEach(x => x.populateVisibleIndexes());
103+
const columns = this.grid && this.grid.pinnedColumns && this.grid.unpinnedColumns ?
104+
this.grid.pinnedColumns.concat(this.grid.unpinnedColumns) : [];
105+
if (!this._hidden && !columns.find(c => c.field === this.field)) {
106+
this.grid.resetColumnCollections();
107+
}
108+
this.grid.columns.filter(x => x.columnLayout).forEach(x => x.populateVisibleIndexes());
104109
}
105110
}
106111

0 commit comments

Comments
 (0)