feat: added iconClass to tabStripItem

This commit is contained in:
Vasil Trifonov
2020-03-13 21:44:38 +02:00
parent b693783780
commit 6fcc276aed
3 changed files with 26 additions and 0 deletions

View File

@@ -2336,6 +2336,8 @@ export class TabStrip extends View {
// @public
export class TabStripItem extends View {
iconClass: string;
iconSource: string;
image: Image;

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