Skip to content

Commit

Permalink
fix: (Platform) fix tabChange event not emitting in Dynamic Page (#4515)
Browse files Browse the repository at this point in the history
* fix: (Platform) fix tabChange event not emitting in Dynamic Page

- also fix disable header example background inherit on hover
- few a11y fixes for disable header example

* add correct log value to display on console
  • Loading branch information
kavya-b committed Feb 3, 2021
1 parent f8cfda6 commit d6fc7e0
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class PlatformDynamicPageFlexibleColumnExampleComponent {
}

onTabChanged(event: DynamicPageTabChangeEvent): void {
console.log('tab changed to ' + event.payload);
console.log('tab changed to ' + event.payload.id);
}

onLayoutChanged(layout: FlexibleColumnLayout): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="overlay-content">
<fdp-dynamic-page size="large" ariaLabel="Example Dynamic Page">
<fdp-dynamic-page-title
title="Balenciaga Tripple S Trainers"
[title]="pageTitle"
subtitle="Oversized multimaterial sneakers with quilted effect"
>
<!-- breadcrumb content -->
Expand Down Expand Up @@ -37,6 +37,7 @@
fdType="positive"
(click)="closePage($event)"
label="Accept"
title="Accept"
></button>
<button
fd-toolbar-item
Expand All @@ -45,25 +46,27 @@
fdType="negative"
(click)="closePage($event)"
label="Reject"
title="Reject"
></button>
<fd-toolbar-separator></fd-toolbar-separator>
</fd-toolbar>
</fdp-dynamic-page-global-actions>
<fdp-dynamic-page-layout-actions>
<!-- layout actions -->
<fd-toolbar fdType="transparent" [clearBorder]="true">
<button fd-button fdType="transparent" aria-label="Resize" (click)="resizeClicked($event)">
<button fd-button fdType="transparent" aria-label="Resize" (click)="resizeClicked($event)" title="Resize">
<i class="sap-icon--resize"></i>
</button>
<button
fd-button
fdType="transparent"
aria-label="Exit Fullscreen"
(click)="closePage($event)"
title="Exit Fullscreen"
>
<i class="sap-icon--exitfullscreen"></i>
</button>
<button fd-button fdType="transparent" aria-label="Close" (click)="closePage($event)">
<button fd-button fdType="transparent" aria-label="Close" (click)="closePage($event)" title="Close">
<i class="sap-icon--decline"></i>
</button>
</fd-toolbar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export class PlatformDynamicPageNonCollapsibleExampleComponent {

fullscreen = false;

pageTitle = 'Balenciaga Tripple S Trainers';

onCollapseChange(event: DynamicPageCollapseChangeEvent): void {
console.log('collapse changed');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ export class PlatformDynamicPageTabbedExampleComponent {
}

onTabChanged(event: DynamicPageTabChangeEvent): void {
console.log('tab changed to ' + event.payload);
console.log('tab changed to ' + event.payload.id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import {
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { TabPanelComponent } from '@fundamental-ngx/core';

import { DynamicPageBackgroundType, CLASS_NAME, DynamicPageResponsiveSize } from '../constants';
import { addClassNameToElement } from '../utils';

/** Dynamic Page tab change event */
export class DynamicPageTabChangeEvent {
constructor(public source: DynamicPageContentComponent, public payload: number) {}
constructor(public source: DynamicPageContentComponent, public payload: TabPanelComponent) {}
}
@Component({
selector: 'fdp-dynamic-page-content',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</header>

<div class="fd-dynamic-page__tabs--overflow" *ngIf="isTabbed" #contentContainer>
<fd-tab-list (selectedIndexChange)="_handleTabChange($event)">
<fd-tab-list (selectedTabChange)="_handleTabChange($event)">
<ng-container *ngFor="let tab of tabs; let i = index">
<fd-tab [title]="tab.tabLabel">
<fdp-dynamic-page-tabbed-content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@
}

.fd-dynamic-page__header--not-collapsible {

.fd-dynamic-page__title-area.is-focus,
.fd-dynamic-page__title-area:focus {
outline: none;
}

.fd-dynamic-page__title-area.is-hover,
.fd-dynamic-page__title-area:hover {
background: inherit;
cursor: default;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
ViewChildren,
ViewEncapsulation
} from '@angular/core';
import { TabPanelComponent } from '@fundamental-ngx/core';
import { fromEvent, Subscription } from 'rxjs';
import { debounceTime, startWith, throttleTime } from 'rxjs/operators';
import { BaseComponent } from '../base';
Expand Down Expand Up @@ -441,8 +442,8 @@ export class DynamicPageComponent extends BaseComponent implements AfterContentI
/** @hidden
* handle tab changes and emit event
*/
_handleTabChange(index: number): void {
const event = new DynamicPageTabChangeEvent(this.contentComponent, index);
_handleTabChange(tabPanel: TabPanelComponent): void {
const event = new DynamicPageTabChangeEvent(this.contentComponent, tabPanel);
this.contentComponent.tabChange.emit(event);
this._cd.detectChanges();
}
Expand Down

0 comments on commit d6fc7e0

Please sign in to comment.