Skip to content

Commit 80caf54

Browse files
authored
Merge branch 'master' into mtihova/fix-15136-master
2 parents 7d9b714 + 959435d commit 80caf54

39 files changed

+1100
-662
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Ignite UI for Angular Change Log
22

33
All notable changes for each version of this project will be documented in this file.
4-
54
## 19.1.0
65
### General
76
- `IgxCarousel`
87
- **Behavioral Changes** - the `maximumIndicatorsCount` input property now defaults to `10`.
98
- **Deprecation** - `CarouselIndicatorsOrientation` enum members `top` and `bottom` have been deprecated and will be removed in a future version. Use `start` and `end` instead.
9+
### New Features
10+
- `IgxBanner`
11+
- Introduced a new `expanded` input property, enabling dynamic control over the banner's state. The banner can now be programmatically set to expanded (visible) or collapsed (hidden) both initially and at runtime. Animations will trigger during runtime updates — the **open animation** plays when `expanded` is set to `true`, and the **close animation** plays when set to `false`. However, no animations will trigger when the property is set initially.
12+
- The banner's event lifecycle (`opening`, `opened`, `closing`, `closed`) only triggers through **user interactions** (e.g., clicking to open/close). Programmatic updates using the `expanded` property will not fire any events.
13+
- If the `expanded` property changes during an ongoing animation, the current animation will **stop** and the opposite animation will begin from the **point where the previous animation left off**. For instance, if the open animation (10 seconds) is interrupted at 6 seconds and `expanded` is set to `false`, the close animation (5 seconds) will start from its 3rd second.
1014

1115
## 19.0.0
1216
### General
@@ -77,6 +81,7 @@ All notable changes for each version of this project will be documented in this
7781
- `IgxGridState`
7882
- When possible the state directive nows reuses the column that already exists on the grid when restoring the state, instead of creating new column instances every time. This removes the need to set any complex objects manually back on the column on `columnInit`. The only instance where this is still necessary is when the column (or its children in case of column groups) have no `field` property so there's no way to uniquely identify the matching column.
7983
- Added support for persisting Multi-Row Layout.
84+
8085
### Themes
8186
- **Breaking Change** `Palettes`
8287
- All palette colors have been migrated to the [CSS relative colors syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_colors/Relative_colors). This means that color consumed as CSS variables no longer need to be wrapped in an `hsl` function.

projects/igniteui-angular-elements/src/analyzer/elements.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ export var registerConfig = [
550550
{ name: "foreignKey" },
551551
{ name: "selectedCells" },
552552
{ name: "gridAPI", writable: true },
553+
{ name: "navigation", writable: true },
553554
{ name: "shouldGenerate", writable: true },
554555
{ name: "rowList" },
555556
{ name: "dataRowList" },
@@ -561,7 +562,6 @@ export var registerConfig = [
561562
{ name: "filteredSortedData" },
562563
{ name: "validation" },
563564
{ name: "cdr" },
564-
{ name: "navigation", writable: true },
565565
{ name: "virtualizationState" },
566566
{ name: "nativeElement" },
567567
{ name: "defaultRowHeight" },
@@ -733,6 +733,7 @@ export var registerConfig = [
733733
],
734734
additionalProperties: [
735735
{ name: "dimensionsSortingExpressions" },
736+
{ name: "navigation", writable: true },
736737
{ name: "allDimensions" },
737738
{ name: "rowList" },
738739
{ name: "dataRowList" },
@@ -742,7 +743,6 @@ export var registerConfig = [
742743
{ name: "validation" },
743744
{ name: "gridAPI" },
744745
{ name: "cdr" },
745-
{ name: "navigation", writable: true },
746746
{ name: "virtualizationState" },
747747
{ name: "nativeElement" },
748748
{ name: "defaultRowHeight" },
@@ -861,13 +861,13 @@ export var registerConfig = [
861861
additionalProperties: [
862862
{ name: "rowIslandAPI", writable: true },
863863
{ name: "gridAPI", writable: true },
864+
{ name: "navigation", writable: true },
864865
{ name: "shouldGenerate", writable: true },
865866
{ name: "rowList" },
866867
{ name: "dataRowList" },
867868
{ name: "transactions" },
868869
{ name: "validation" },
869870
{ name: "cdr" },
870-
{ name: "navigation", writable: true },
871871
{ name: "nativeElement" },
872872
{ name: "defaultRowHeight" },
873873
{ name: "defaultHeaderGroupMinWidth" },

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

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ describe('igxBanner', () => {
3333
IgxBannerOneButtonComponent,
3434
IgxBannerSampleComponent,
3535
IgxBannerCustomTemplateComponent,
36-
SimpleBannerEventsComponent
36+
SimpleBannerEventsComponent,
37+
IgxBannerInitializedOpenComponent
3738
]
3839
}).compileComponents();
3940
}));
@@ -395,6 +396,36 @@ describe('igxBanner', () => {
395396
expect(banner.closing.emit).toHaveBeenCalledTimes(2);
396397
expect(banner.closed.emit).toHaveBeenCalledTimes(1);
397398
}));
399+
400+
it('Should toggle banner state when expanded property changes', fakeAsync(() => {
401+
const fixture = TestBed.createComponent(IgxBannerInitializedOpenComponent);
402+
fixture.detectChanges();
403+
const banner = fixture.componentInstance.banner;
404+
405+
banner.expanded = false;
406+
tick();
407+
fixture.detectChanges();
408+
409+
expect(banner.expanded).toBeFalse();
410+
411+
banner.expanded = true;
412+
tick();
413+
fixture.detectChanges();
414+
expect(banner.expanded).toBeTrue();
415+
expect(banner.elementRef.nativeElement.style.display).toEqual('block');
416+
417+
banner.expanded = false;
418+
tick();
419+
fixture.detectChanges();
420+
expect(banner.expanded).toBeFalse();
421+
expect(banner.elementRef.nativeElement.style.display).toEqual('');
422+
423+
banner.expanded = true;
424+
tick();
425+
fixture.detectChanges();
426+
expect(banner.expanded).toBeTrue();
427+
expect(banner.elementRef.nativeElement.style.display).toEqual('block');
428+
}));
398429
});
399430

400431
describe('Rendering tests: ', () => {
@@ -485,6 +516,16 @@ describe('igxBanner', () => {
485516
expect(panel.attributes.getNamedItem('role').nodeValue).toEqual('status');
486517
expect(panel.attributes.getNamedItem('aria-live').nodeValue).toEqual('polite');
487518
}));
519+
520+
it('Should initialize banner as open when expanded is set to true', fakeAsync(() => {
521+
const fixture = TestBed.createComponent(IgxBannerInitializedOpenComponent);
522+
fixture.detectChanges();
523+
const banner = fixture.componentInstance.banner;
524+
525+
expect(banner.expanded).toBeTrue();
526+
expect(banner.elementRef.nativeElement.style.display).toEqual('block');
527+
expect(banner.elementRef.nativeElement.querySelector('.' + CSS_CLASS_BANNER)).not.toBeNull();
528+
}));
488529
});
489530

490531
const getBaseClassElements = <T>(fixture: ComponentFixture<T>) => {
@@ -601,3 +642,19 @@ export class SimpleBannerEventsComponent {
601642
event.cancel = this.cancelFlag;
602643
}
603644
}
645+
646+
@Component({
647+
template: `
648+
<div>
649+
<igx-banner [expanded]="true">
650+
Banner initialized as open.
651+
</igx-banner>
652+
</div>
653+
`,
654+
standalone: true,
655+
imports: [IgxBannerComponent]
656+
})
657+
export class IgxBannerInitializedOpenComponent {
658+
@ViewChild(IgxBannerComponent, { static: true })
659+
public banner: IgxBannerComponent;
660+
}

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

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,12 @@ export class IgxBannerComponent implements IToggleView {
142142
return this._animationSettings ? this._animationSettings : this._expansionPanel.animationSettings;
143143
}
144144

145-
/**
145+
/**
146146
* Gets/Sets the resource strings.
147147
*
148148
* @remarks
149149
* By default it uses EN resources.
150150
*/
151-
152151
@Input()
153152
public set resourceStrings(value: IBannerResourceStrings) {
154153
this._resourceStrings = Object.assign({}, this._resourceStrings, value);
@@ -157,14 +156,52 @@ export class IgxBannerComponent implements IToggleView {
157156
public get resourceStrings(): IBannerResourceStrings {
158157
return this._resourceStrings;
159158
}
159+
160+
/**
161+
* Gets/Sets whether the banner is expanded (visible) or collapsed (hidden).
162+
* Defaults to `false`.
163+
* Setting to `true` opens the banner, while `false` closes it.
164+
*
165+
* @example
166+
* // Expand the banner
167+
* banner.expanded = true;
168+
*
169+
* @example
170+
* // Collapse the banner
171+
* banner.expanded = false;
172+
*
173+
* @example
174+
* // Check if the banner is expanded
175+
* const isExpanded = banner.expanded;
176+
*/
177+
@Input()
178+
public get expanded(): boolean {
179+
return this._expanded;
180+
}
181+
182+
public set expanded(value: boolean) {
183+
if (value === this._expanded) {
184+
return;
185+
}
186+
187+
this._expanded = value;
188+
this._shouldFireEvent = true;
189+
190+
if (value) {
191+
this._expansionPanel.open();
192+
} else {
193+
this._expansionPanel.close();
194+
}
195+
}
196+
160197
/**
161-
* Gets whether banner is collapsed
198+
* Gets whether the banner is collapsed.
162199
*
163200
* ```typescript
164201
* const isCollapsed: boolean = banner.collapsed;
165202
* ```
166203
*/
167-
public get collapsed() {
204+
public get collapsed(): boolean {
168205
return this._expansionPanel.collapsed;
169206
}
170207

@@ -195,6 +232,8 @@ export class IgxBannerComponent implements IToggleView {
195232
@ContentChild(IgxBannerActionsDirective)
196233
private _bannerActionTemplate: IgxBannerActionsDirective;
197234

235+
private _expanded: boolean = false;
236+
private _shouldFireEvent: boolean = false;
198237
private _bannerEvent: BannerEventArgs;
199238
private _animationSettings: ToggleAnimationSettings;
200239
private _resourceStrings = getCurrentResourceStrings(BannerResourceStringsEN);
@@ -216,7 +255,7 @@ export class IgxBannerComponent implements IToggleView {
216255
* ```
217256
*/
218257
public open(event?: Event) {
219-
this._bannerEvent = { owner: this, event};
258+
this._bannerEvent = { owner: this, event };
220259
const openingArgs: BannerCancelEventArgs = {
221260
owner: this,
222261
event,
@@ -227,6 +266,8 @@ export class IgxBannerComponent implements IToggleView {
227266
return;
228267
}
229268
this._expansionPanel.open(event);
269+
this._expanded = true;
270+
this._shouldFireEvent = false;
230271
}
231272

232273
/**
@@ -255,6 +296,8 @@ export class IgxBannerComponent implements IToggleView {
255296
return;
256297
}
257298
this._expansionPanel.close(event);
299+
this._expanded = false;
300+
this._shouldFireEvent = false;
258301
}
259302

260303
/**
@@ -281,11 +324,17 @@ export class IgxBannerComponent implements IToggleView {
281324

282325
/** @hidden */
283326
public onExpansionPanelOpen() {
327+
if (this._shouldFireEvent) {
328+
return;
329+
}
284330
this.opened.emit(this._bannerEvent);
285331
}
286332

287333
/** @hidden */
288334
public onExpansionPanelClose() {
335+
if (this._shouldFireEvent) {
336+
return;
337+
}
289338
this.closed.emit(this._bannerEvent);
290339
}
291340
}

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 }}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,15 @@ export class IgxMonthsViewComponent extends IgxCalendarViewDirective implements
135135
super(dayInterval);
136136
}
137137

138+
/**
139+
* @hidden
140+
*/
141+
protected onMouseDown() {
142+
if (this.tabIndex !== -1) {
143+
this.el.nativeElement.focus();
144+
}
145+
}
146+
138147
/**
139148
* Returns the locale representation of the month in the months view.
140149
*

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
[date]="date"
1414
[showActive]="showActive"
1515
(itemSelection)="selectDate($event)"
16+
(mousedown)="onMouseDown()"
1617
>
1718
<span class="igx-calendar-view__item-inner" aria-hidden="true">
1819
{{ formattedYear(year).formatted }}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,13 @@ export class IgxYearsViewComponent extends IgxCalendarViewDirective implements C
154154
year: this.yearFormat,
155155
});
156156
}
157+
158+
/**
159+
* @hidden
160+
*/
161+
protected onMouseDown() {
162+
if (this.tabIndex !== -1) {
163+
this.el.nativeElement.focus();
164+
}
165+
}
157166
}

0 commit comments

Comments
 (0)