bixi
Version:
企业级中后台前端解决方案
84 lines (73 loc) • 2.26 kB
text/typescript
import { ChangeDetectionStrategy, Component, HostBinding, Input, ViewEncapsulation } from '@angular/core';
import { isFunction } from '@bixi/core/utils';
import { NzSafeAny } from 'ng-zorro-antd/core/types';
import { EProgressStatus, IFn, IProgressCol } from '../table.type';
import { hasKey } from '../utils';
import { ColBase } from './col.base';
export class BixiTableColProgressComponent extends ColBase {
defaultStatus: NzSafeAny = {
'stop': {
progressColor: '#C0CCDA'
},
'processing': {
progressColor: '#107CEE'
},
'success': {
progressColor: '#21BC29'
},
'failed': {
progressColor: '#EE5144'
},
'starting': {
progressColor: '#E0E6ED'
}
};
get status(): string {
return isFunction(this.col.status) ? (this.col.status as IFn<EProgressStatus>)(this.value, this.row, this.index) : this.col.status as string;
}
get progressTooltip() {
if (hasKey(this.col, 'tooltip')) {
return this.tooltip;
}
return false;
}
col: IProgressCol;
get _width() {
return this.col.width;
}
get _display() {
return 'block';
}
get progressStatus() {
return this.status;
}
get color(): string {
return this.defaultStatus[this.status].progressColor;
}
format = (percent: number) => percent + '%';
}