Added iconClass property to TabStripItem (#8440)

* chore: ignore e2e folder's other subfolders

* feat: added iconClass to tabStripItem
This commit is contained in:
Vasil Trifonov
2020-03-16 14:22:24 +02:00
committed by GitHub
parent 243dc98005
commit 270988d26e
4 changed files with 36 additions and 1 deletions

View File

@@ -16,6 +16,11 @@ export class TabStripItem extends View {
*/
title: string;
/**
* Gets or sets the CSS class name of the icon in the tab strip entry.
*/
iconClass: string;
/**
* Gets or sets the icon source of the tab strip entry.
*/

View File

@@ -30,6 +30,7 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
private _title: string;
private _iconSource: string;
private _iconClass: string;
private _highlightedHandler: () => void;
private _normalHandler: () => void;
@@ -59,6 +60,22 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
}
}
get iconClass(): string {
if (this.isLoaded) {
return this.image.className;
}
return this._iconClass;
}
set iconClass(value: string) {
this._iconClass = value;
if (this.isLoaded) {
this.image.className = value;
}
}
get iconSource(): string {
if (this.isLoaded) {
return this.image.src;
@@ -79,6 +96,7 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
if (!this.image) {
const image = new Image();
image.src = this.iconSource;
image.className = this.iconClass;
this.image = image;
this._addView(this.image);
}
@@ -176,6 +194,7 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
if (value instanceof Image) {
this.image = <Image>value;
this.iconSource = (<Image>value).src;
this.iconClass = (<Image>value).className;
this._addView(value);
// selectedIndexProperty.coerce(this);
}