2018-02-10 15:18:01 +00:00
|
|
|
import ngModule from '../../module';
|
2018-03-01 15:52:35 +00:00
|
|
|
import './style.scss';
|
2017-01-31 13:13:06 +00:00
|
|
|
|
2018-02-21 10:41:22 +00:00
|
|
|
class Icon {
|
|
|
|
constructor($attrs) {
|
|
|
|
this.$attrs = $attrs;
|
|
|
|
this._icon = null;
|
|
|
|
}
|
|
|
|
set icon(value) {
|
|
|
|
this._icon = value;
|
|
|
|
this.drawIcon();
|
|
|
|
}
|
|
|
|
get icon() {
|
|
|
|
return this._icon;
|
|
|
|
}
|
|
|
|
drawIcon() {
|
|
|
|
if (this.icon.startsWith('icon-')) {
|
|
|
|
this.iconClass = this.icon;
|
|
|
|
this.iconContent = '';
|
|
|
|
} else {
|
|
|
|
this.iconClass = 'material-icons';
|
|
|
|
this.iconContent = this.icon;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Icon.$inject = ['$attrs'];
|
|
|
|
|
2020-07-24 15:46:06 +00:00
|
|
|
ngModule.vnComponent('vnIcon', {
|
2023-01-03 07:41:58 +00:00
|
|
|
template: '<i class="{{::$ctrl.iconClass}} unselectable notranslate">{{::$ctrl.iconContent}}</i>',
|
2018-02-21 10:41:22 +00:00
|
|
|
controller: Icon,
|
2017-06-13 11:08:06 +00:00
|
|
|
bindings: {
|
|
|
|
icon: '@'
|
2017-06-15 13:00:43 +00:00
|
|
|
}
|
2017-06-13 11:08:06 +00:00
|
|
|
});
|