@deepkit/desktop-ui
Version:
Library for desktop UI widgets in Angular 10+
76 lines (63 loc) • 1.86 kB
text/typescript
/*
* Deepkit Framework
* Copyright (C) 2021 Deepkit UG, Marc J. Schmidt
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the MIT License.
*
* You should have received a copy of the MIT License along with this program.
*/
import { Component, HostBinding, Input, OnChanges, OnInit } from '@angular/core';
export class IconComponent implements OnInit, OnChanges {
/**
* The icon for this button. Either a icon name same as for dui-icon, or an image path.
*/
name?: string;
/**
* Change in the icon size. Should not be necessary usually.
*/
size?: number;
clickable: boolean | '' = false;
color?: string;
public usedSize = 17;
get isClickable() {
return false !== this.clickable;
}
disabled: boolean = false;
get isDisabled() {
return false !== this.disabled;
}
constructor() {
}
ngOnChanges(): void {
if (this.size) {
this.usedSize = this.size;
}
if (!this.size && this.name) {
const pos = this.name.indexOf('_');
if (pos !== -1) {
const potentialNumber = parseInt(this.name.slice(0, pos), 10);
if (potentialNumber) {
this.usedSize = potentialNumber;
}
}
}
}
ngOnInit() {
}
}