Skip to content

Commit 1c27cde

Browse files
authored
Merge branch '18.2.x' into ttonev/fix-14970-18.2
2 parents 4346704 + 22f33f1 commit 1c27cde

File tree

189 files changed

+2283
-832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+2283
-832
lines changed

projects/igniteui-angular/src/lib/action-strip/action-strip.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { IgxIconComponent } from '../icon/icon.component';
2424
import { IgxDropDownItemNavigationDirective } from '../drop-down/drop-down-navigation.directive';
2525
import { IgxToggleActionDirective } from '../directives/toggle/toggle.directive';
2626
import { IgxRippleDirective } from '../directives/ripple/ripple.directive';
27-
import { IgxButtonDirective } from '../directives/button/button.directive';
2827
import { NgIf, NgFor, NgTemplateOutlet } from '@angular/common';
2928
import { getCurrentResourceStrings } from '../core/i18n/resources';
3029
import { IgxIconButtonDirective } from '../directives/button/icon-button.directive';
@@ -78,7 +77,6 @@ export class IgxActionStripMenuItemDirective {
7877
NgIf,
7978
NgFor,
8079
NgTemplateOutlet,
81-
IgxButtonDirective,
8280
IgxIconButtonDirective,
8381
IgxRippleDirective,
8482
IgxToggleActionDirective,

projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-action-button.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Component, Input, TemplateRef, ViewChild, Output, EventEmitter, ElementRef, booleanAttribute } from '@angular/core';
22
import { IgxIconComponent } from '../../icon/icon.component';
33
import { IgxRippleDirective } from '../../directives/ripple/ripple.directive';
4-
import { IgxButtonDirective } from '../../directives/button/button.directive';
54
import { NgIf } from '@angular/common';
65
import { IgxIconButtonDirective } from '../../directives/button/icon-button.directive';
76

@@ -12,7 +11,7 @@ import { IgxIconButtonDirective } from '../../directives/button/icon-button.dire
1211
selector: 'igx-grid-action-button',
1312
templateUrl: 'grid-action-button.component.html',
1413
standalone: true,
15-
imports: [NgIf, IgxButtonDirective, IgxRippleDirective, IgxIconComponent, IgxIconButtonDirective]
14+
imports: [NgIf, IgxRippleDirective, IgxIconComponent, IgxIconButtonDirective]
1615
})
1716
export class IgxGridActionButtonComponent {
1817

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,39 @@ describe('Avatar', () => {
159159
expect(hostEl.getAttribute('aria-roledescription')).toEqual('image avatar');
160160
expect(hostEl.getAttribute('aria-label')).toEqual('avatar');
161161
});
162+
163+
it('Normalizes the value of the `src` input', () => {
164+
const fixture = TestBed.createComponent(InitImageAvatarComponent);
165+
fixture.detectChanges();
166+
167+
const instance = fixture.componentInstance.avatar;
168+
instance.src = "/assets/Test - 17.jpg";
169+
fixture.detectChanges();
170+
171+
expect(instance.src).toEqual("/assets/Test%20-%2017.jpg");
172+
});
173+
174+
it('should not throw error if src is null', () => {
175+
const fixture = TestBed.createComponent(InitImageAvatarComponent);
176+
fixture.detectChanges();
177+
expect(() => {
178+
const instance = fixture.componentInstance.avatar;
179+
instance.src = null;
180+
fixture.detectChanges();
181+
}).not.toThrow();
182+
});
183+
184+
it('avatar with [src] and fallback [initials] should not throw error if src is null', () => {
185+
const fixture = TestBed.createComponent(AvatarWithAttribsComponent);
186+
fixture.detectChanges();
187+
const instance = fixture.componentInstance.avatar;
188+
expect(instance.type).toEqual(IgxAvatarType.INITIALS);
189+
expect(instance.initials).toEqual('ZK');
190+
expect(() => {
191+
instance.src = null;
192+
fixture.detectChanges();
193+
}).not.toThrow();
194+
});
162195
});
163196

164197
@Component({

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
ViewChild
1010
} from '@angular/core';
1111

12-
import { mkenum } from '../core/utils';
12+
import { mkenum, normalizeURI } from '../core/utils';
1313
import { IgxIconComponent } from '../icon/icon.component';
1414

1515
let NEXT_ID = 0;
@@ -202,7 +202,13 @@ export class IgxAvatarComponent implements OnInit {
202202
* @igxFriendlyName Image URL
203203
*/
204204
@Input()
205-
public src: string;
205+
public set src(value: string) {
206+
this._src = normalizeURI(value);
207+
}
208+
209+
public get src() {
210+
return this._src;
211+
}
206212

207213
/** @hidden @internal */
208214
@ViewChild('defaultTemplate', { read: TemplateRef, static: true })
@@ -225,6 +231,7 @@ export class IgxAvatarComponent implements OnInit {
225231
* @internal
226232
*/
227233
private _size: string | IgxAvatarSize;
234+
private _src: string;
228235

229236
/**
230237
* Returns the size of the avatar.
@@ -335,7 +342,7 @@ export class IgxAvatarComponent implements OnInit {
335342
* @internal
336343
*/
337344
public getSrcUrl() {
338-
return `url(${this.src})`;
345+
return `url("${this.src}")`;
339346
}
340347

341348
/** @hidden @internal */

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
booleanAttribute,
1414
HostListener,
1515
} from '@angular/core';
16-
import { NgIf, NgTemplateOutlet, NgStyle, NgFor, DatePipe } from '@angular/common';
16+
import { NgIf, NgTemplateOutlet, NgFor, DatePipe } from '@angular/common';
1717
import { NG_VALUE_ACCESSOR } from '@angular/forms';
1818

1919
import {
@@ -72,7 +72,7 @@ let NEXT_ID = 0;
7272
selector: 'igx-calendar',
7373
templateUrl: 'calendar.component.html',
7474
standalone: true,
75-
imports: [NgIf, NgTemplateOutlet, IgxCalendarScrollPageDirective, NgStyle, IgxIconComponent, NgFor, IgxDaysViewComponent, IgxMonthsViewComponent, IgxYearsViewComponent, DatePipe, IgxMonthViewSlotsCalendar, IgxGetViewDateCalendar],
75+
imports: [NgIf, NgTemplateOutlet, IgxCalendarScrollPageDirective, IgxIconComponent, NgFor, IgxDaysViewComponent, IgxMonthsViewComponent, IgxYearsViewComponent, DatePipe, IgxMonthViewSlotsCalendar, IgxGetViewDateCalendar],
7676
})
7777
export class IgxCalendarComponent extends IgxCalendarBaseDirective implements AfterViewInit, OnDestroy {
7878
/**

projects/igniteui-angular/src/lib/calendar/common/calendar-view.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
import { CalendarDay, DayInterval } from "../common/model";
2222
import { getNextActiveDate, isDateInRanges } from "./helpers";
2323
import { DateRangeType } from "../../core/dates";
24+
import { isDate } from "../../core/utils";
2425

2526
export enum Direction {
2627
NEXT = 1,
@@ -141,7 +142,7 @@ export abstract class IgxCalendarViewDirective implements ControlValueAccessor {
141142
*/
142143
@Input()
143144
public set date(value: Date) {
144-
if (!(value instanceof Date)) return;
145+
if (!isDate(value)) return;
145146

146147
this._date = value;
147148
}

projects/igniteui-angular/src/lib/calendar/common/model.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { isDate } from "../../core/utils";
2+
13
/* eslint-disable @typescript-eslint/consistent-type-definitions */
24
export type DayParameter = CalendarDay | Date;
35

@@ -19,7 +21,7 @@ export const daysInWeek = 7;
1921
const millisecondsInDay = 86400000;
2022

2123
export function toCalendarDay(date: DayParameter) {
22-
return date instanceof Date ? CalendarDay.from(date) : date;
24+
return isDate(date) ? CalendarDay.from(date) : date;
2325
}
2426

2527
function checkRollover(original: CalendarDay, modified: CalendarDay) {

projects/igniteui-angular/src/lib/calendar/days-view/day-item.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ export class IgxDayItemComponent {
111111
@HostBinding('class.igx-days-view__date--selected')
112112
public get isSelectedCSS(): boolean {
113113
const selectable =
114-
!this.isInactive || (this.isWithinRange && this.selection === "range");
114+
!this.isInactive || this.isWithinPreviewRange ||
115+
(this.isWithinRange && this.selection === "range");
115116
return !this.isDisabled && selectable && this.selected;
116117
}
117118

projects/igniteui-angular/src/lib/calendar/month-picker/month-picker.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
OnDestroy,
1010
OnInit,
1111
} from "@angular/core";
12-
import { NgIf, NgStyle, NgTemplateOutlet, DatePipe } from "@angular/common";
12+
import { NgIf, NgTemplateOutlet, DatePipe } from "@angular/common";
1313
import { NG_VALUE_ACCESSOR } from "@angular/forms";
1414

1515
import { IgxMonthsViewComponent } from "../months-view/months-view.component";
@@ -40,7 +40,6 @@ let NEXT_ID = 0;
4040
standalone: true,
4141
imports: [
4242
NgIf,
43-
NgStyle,
4443
NgTemplateOutlet,
4544
DatePipe,
4645
IgxIconComponent,

projects/igniteui-angular/src/lib/calendar/months-view/months-view.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
[date]="date"
1313
[showActive]="showActive"
1414
(itemSelection)="selectDate($event)"
15+
(mousedown)="onMouseDown()"
1516
>
1617
<span class="igx-calendar-view__item-inner" aria-hidden="true">
1718
{{ formattedMonth(month).formatted | titlecase }}

0 commit comments

Comments
 (0)