Skip to content

Commit

Permalink
Fixed #9367 - tabView: progomatically changing tabPanel disabled does…
Browse files Browse the repository at this point in the history
… not have visual affect until tabs are clicked
  • Loading branch information
yigitfindikli committed Oct 7, 2020
1 parent 90bbc21 commit dcb96fd
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/app/components/tabview/tabview.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {NgModule,Component,ElementRef,OnDestroy,Input,Output,EventEmitter,AfterContentInit,
ContentChildren,QueryList,TemplateRef,EmbeddedViewRef,ViewContainerRef,ChangeDetectorRef,ChangeDetectionStrategy, ViewEncapsulation, ViewChild, AfterViewChecked} from '@angular/core';
ContentChildren,QueryList,TemplateRef,EmbeddedViewRef,ViewContainerRef,ChangeDetectorRef,ChangeDetectionStrategy, ViewEncapsulation, ViewChild, AfterViewChecked, forwardRef, Inject} from '@angular/core';
import {CommonModule} from '@angular/common';
import {TooltipModule} from 'primeng/tooltip';
import {RippleModule} from 'primeng/ripple';
Expand All @@ -25,8 +25,6 @@ export class TabPanel implements AfterContentInit,OnDestroy {

@Input() header: string;

@Input() disabled: boolean;

@Input() closable: boolean;

@Input() headerStyle: any;
Expand All @@ -49,13 +47,13 @@ export class TabPanel implements AfterContentInit,OnDestroy {

@ContentChildren(PrimeTemplate) templates: QueryList<any>;

constructor(public viewContainer: ViewContainerRef, public cd: ChangeDetectorRef) {}

closed: boolean;

view: EmbeddedViewRef<any>;

_selected: boolean;

_disabled: boolean;

loaded: boolean;

Expand All @@ -64,7 +62,13 @@ export class TabPanel implements AfterContentInit,OnDestroy {
contentTemplate: TemplateRef<any>;

headerTemplate: TemplateRef<any>;


tabView: TabView;

constructor(@Inject(forwardRef(() => TabView)) tabView, public viewContainer: ViewContainerRef, public cd: ChangeDetectorRef) {
this.tabView = tabView as TabView;
}

ngAfterContentInit() {
this.templates.forEach((item) => {
switch(item.getType()) {
Expand Down Expand Up @@ -96,6 +100,15 @@ export class TabPanel implements AfterContentInit,OnDestroy {

this.loaded = true;
}

@Input() get disabled(): boolean {
return this._disabled;
};

set disabled(disabled: boolean) {
this._disabled = disabled;
this.tabView.cd.markForCheck();
}

ngOnDestroy() {
this.view = null;
Expand Down Expand Up @@ -193,6 +206,7 @@ export class TabView implements AfterContentInit,AfterViewChecked,BlockableUI {

this.tabChanged = true;
}

this.cd.markForCheck();
}

Expand Down

0 comments on commit dcb96fd

Please sign in to comment.