@rdkmaster/jigsaw-labs
Version:
Jigsaw, the next generation component set for RDK
77 lines (66 loc) • 1.98 kB
text/typescript
import {Component, Input, NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {AbstractJigsawComponent} from '../common';
import {DomSanitizer} from "@angular/platform-browser";
import {CommonUtils} from "../../core/utils/common-utils";
/**
* 图标控件,支持输入fontawesome的图标
*
* $demo = button/basic
*/
export class JigsawIcon extends AbstractJigsawComponent {
public _$secureUrl;
private _href: string = 'javascript:void(0);';
/**
* 为true 生成的html是 <a class="fa fa-edit">some text</a>
* 为false 生成的html是 <span class="fa fa-edit">some text</span>
*/
public isLinkButton: boolean = false;
/**
* 图标类型 fa fa-xxx
*/
public icon: string;
/**
* 图标的文本
*/
public text: string = '';
/**
* 超链接 href
*/
public set href(value: any) {
if (this._href == value || CommonUtils.isUndefined(value)) {
if (CommonUtils.isUndefined(this._$secureUrl)) {
this._$secureUrl = this._sanitizer.bypassSecurityTrustResourceUrl(this._href);
}
return;
}
this._href = value;
this._$secureUrl = this._sanitizer.bypassSecurityTrustResourceUrl(this._href);
}
/**
* 图标的文本
*/
public target: string = '_blank';
public title: string = '';
constructor(private _sanitizer: DomSanitizer) {
super();
this._$secureUrl = this._sanitizer.bypassSecurityTrustResourceUrl(this._href);
}
}
export class JigsawIconModule {
}