yoyo-ng-modulewindy
Version:
服务于52ABP模板的前端开源的相关组件内容。整合了ng-alain和你NG ZORRO的内容
70 lines • 2.78 kB
JavaScript
import { Component, Input, ViewChild, TemplateRef, ElementRef, Renderer2, } from '@angular/core';
import { isEmpty, toBoolean } from 'yoyo-ng-module/util';
var DescListItemComponent = /** @class */ (function () {
function DescListItemComponent(renderer) {
this.renderer = renderer;
// region fields
this._term = '';
this._noDefault = false;
this.detailClass = '';
}
Object.defineProperty(DescListItemComponent.prototype, "term", {
set: function (value) {
if (value instanceof TemplateRef) {
this._term = null;
this._termTpl = value;
}
else
this._term = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DescListItemComponent.prototype, "noDefault", {
get: function () {
return this._noDefault;
},
set: function (value) {
this._noDefault = toBoolean(value);
},
enumerable: true,
configurable: true
});
DescListItemComponent.prototype.checkContent = function () {
if (!this.contentElement) {
return;
}
var el = this.contentElement.nativeElement;
var cls = "ad-desc-list__default";
if (!this.noDefault && isEmpty(el)) {
this.renderer.addClass(el, cls);
}
else {
this.renderer.removeClass(el, cls);
}
};
DescListItemComponent.prototype.ngAfterViewInit = function () {
this.checkContent();
};
DescListItemComponent.decorators = [
{ type: Component, args: [{
selector: 'desc-list-item',
template: "\n <ng-template #tpl>\n <div class=\"ad-desc-list__term\" *ngIf=\"_term || _termTpl\">\n <ng-container *ngIf=\"_term; else _termTpl\">{{_term}}</ng-container>\n </div>\n <div class=\"ad-desc-list__detail {{detailClass}}\" (cdkObserveContent)=\"checkContent()\" #contentElement><ng-content></ng-content></div>\n </ng-template>\n ",
preserveWhitespaces: false,
},] },
];
/** @nocollapse */
DescListItemComponent.ctorParameters = function () { return [
{ type: Renderer2 }
]; };
DescListItemComponent.propDecorators = {
contentElement: [{ type: ViewChild, args: ['contentElement',] }],
term: [{ type: Input }],
noDefault: [{ type: Input }],
detailClass: [{ type: Input }],
tpl: [{ type: ViewChild, args: ['tpl',] }]
};
return DescListItemComponent;
}());
export { DescListItemComponent };
//# sourceMappingURL=desc-list-item.component.js.map