yoyo-ng-modulewindy
Version:
服务于52ABP模板的前端开源的相关组件内容。整合了ng-alain和你NG ZORRO的内容
125 lines • 5 kB
JavaScript
import { Component, TemplateRef, Input, ElementRef, Renderer2, ChangeDetectorRef, ChangeDetectionStrategy, } from '@angular/core';
import { toNumber } from 'yoyo-ng-module/util';
var NumberInfoComponent = /** @class */ (function () {
function NumberInfoComponent(el, renderer, cd) {
this.el = el;
this.renderer = renderer;
this.cd = cd;
this._title = '';
this._subTitle = '';
this._total = '';
this._isSubTotal = false;
this._subTotal = '';
/** 状态样式 */
this.theme = 'light';
this._gap = 8;
this._classMap = [];
}
Object.defineProperty(NumberInfoComponent.prototype, "title", {
/** 标题 */
set: function (value) {
if (value instanceof TemplateRef) {
this._title = null;
this._titleTpl = value;
}
else
this._title = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(NumberInfoComponent.prototype, "subTitle", {
/** 子标题 */
set: function (value) {
if (value instanceof TemplateRef) {
this._subTitle = null;
this._subTitleTpl = value;
}
else
this._subTitle = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(NumberInfoComponent.prototype, "total", {
/** 总量 */
set: function (value) {
if (value instanceof TemplateRef) {
this._total = null;
this._totalTpl = value;
}
else
this._total = '' + value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(NumberInfoComponent.prototype, "subTotal", {
/** 总量后缀 */
set: function (value) {
if (value instanceof TemplateRef) {
this._subTotal = null;
this._subTotalTpl = value;
}
else
this._subTotal = value;
this._isSubTotal = !!value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(NumberInfoComponent.prototype, "gap", {
/** 设置数字和描述直接的间距(像素) */
get: function () {
return this._gap;
},
set: function (value) {
this._gap = toNumber(value);
},
enumerable: true,
configurable: true
});
NumberInfoComponent.prototype.setClass = function () {
var _this = this;
this._classMap.forEach(function (cls) {
return _this.renderer.removeClass(_this.el.nativeElement, cls);
});
this._classMap = ['ad-number-info'];
if (this.theme)
this._classMap.push(this.theme);
this._classMap.forEach(function (cls) {
return _this.renderer.addClass(_this.el.nativeElement, cls);
});
this.cd.detectChanges();
};
NumberInfoComponent.prototype.ngOnChanges = function () {
this.setClass();
};
NumberInfoComponent.decorators = [
{ type: Component, args: [{
selector: 'number-info',
template: "\n <div *ngIf=\"_title || _titleTpl\" class=\"title\"><ng-container *ngIf=\"_title; else _titleTpl\">{{_title}}</ng-container></div>\n <div *ngIf=\"_subTitle || _subTitleTpl\" class=\"sub-title\"><ng-container *ngIf=\"_subTitle; else _subTitleTpl\">{{_subTitle}}</ng-container></div>\n <div class=\"value\" [ngStyle]=\"{'margin-top.px': gap}\">\n <span><ng-container *ngIf=\"_total; else _totalTpl\">{{_total}}</ng-container><em class=\"suffix\" *ngIf=\"suffix\">{{suffix}}</em></span>\n <span *ngIf=\"status || _isSubTotal\" class=\"sub-total\">\n <ng-container *ngIf=\"_subTotal; else _subTotalTpl\">{{_subTotal}}</ng-container>\n <i *ngIf=\"status\" class=\"anticon anticon-caret-{{status}}\"></i>\n </span>\n </div>\n ",
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
},] },
];
/** @nocollapse */
NumberInfoComponent.ctorParameters = function () { return [
{ type: ElementRef },
{ type: Renderer2 },
{ type: ChangeDetectorRef }
]; };
NumberInfoComponent.propDecorators = {
title: [{ type: Input }],
subTitle: [{ type: Input }],
total: [{ type: Input }],
subTotal: [{ type: Input }],
suffix: [{ type: Input }],
status: [{ type: Input }],
theme: [{ type: Input }],
gap: [{ type: Input }]
};
return NumberInfoComponent;
}());
export { NumberInfoComponent };
//# sourceMappingURL=number-info.component.js.map