ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
96 lines • 7.38 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Input, Renderer2, ViewChild, ViewEncapsulation } from '@angular/core';
export class NzTimelineItemComponent {
/**
* @param {?} renderer
* @param {?} cdr
*/
constructor(renderer, cdr) {
this.renderer = renderer;
this.cdr = cdr;
this.nzColor = 'blue';
this.isLast = false;
}
/**
* @return {?}
*/
ngOnInit() {
this.tryUpdateCustomColor();
}
/**
* @param {?} changes
* @return {?}
*/
ngOnChanges(changes) {
if (changes.nzColor) {
this.tryUpdateCustomColor();
}
}
/**
* @return {?}
*/
detectChanges() {
this.cdr.detectChanges();
}
/**
* @private
* @return {?}
*/
tryUpdateCustomColor() {
/** @type {?} */
const defaultColors = ['blue', 'red', 'green'];
/** @type {?} */
const circle = this.liTemplate.nativeElement.querySelector('.ant-timeline-item-head');
if (defaultColors.indexOf(this.nzColor) === -1) {
this.renderer.setStyle(circle, 'border-color', this.nzColor);
}
else {
this.renderer.removeStyle(circle, 'border-color');
}
}
}
NzTimelineItemComponent.decorators = [
{ type: Component, args: [{
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
selector: 'nz-timeline-item, [nz-timeline-item]',
template: "<li\n class=\"ant-timeline-item\"\n [class.ant-timeline-item-right]=\"position === 'right'\"\n [class.ant-timeline-item-left]=\"position === 'left'\"\n [class.ant-timeline-item-last]=\"isLast\"\n #liTemplate>\n <div class=\"ant-timeline-item-tail\"></div>\n <div\n class=\"ant-timeline-item-head\"\n [class.ant-timeline-item-head-red]=\"nzColor === 'red'\"\n [class.ant-timeline-item-head-blue]=\"nzColor === 'blue'\"\n [class.ant-timeline-item-head-green]=\"nzColor === 'green'\"\n [class.ant-timeline-item-head-custom]=\"!!nzDot\">\n <ng-container *nzStringTemplateOutlet=\"nzDot\">{{ nzDot }}</ng-container>\n </div>\n <div class=\"ant-timeline-item-content\">\n <ng-content></ng-content>\n </div>\n</li>"
}] }
];
/** @nocollapse */
NzTimelineItemComponent.ctorParameters = () => [
{ type: Renderer2 },
{ type: ChangeDetectorRef }
];
NzTimelineItemComponent.propDecorators = {
liTemplate: [{ type: ViewChild, args: ['liTemplate',] }],
nzColor: [{ type: Input }],
nzDot: [{ type: Input }]
};
if (false) {
/** @type {?} */
NzTimelineItemComponent.prototype.liTemplate;
/** @type {?} */
NzTimelineItemComponent.prototype.nzColor;
/** @type {?} */
NzTimelineItemComponent.prototype.nzDot;
/** @type {?} */
NzTimelineItemComponent.prototype.isLast;
/** @type {?} */
NzTimelineItemComponent.prototype.position;
/**
* @type {?}
* @private
*/
NzTimelineItemComponent.prototype.renderer;
/**
* @type {?}
* @private
*/
NzTimelineItemComponent.prototype.cdr;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotdGltZWxpbmUtaXRlbS5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZy16b3Jyby1hbnRkLXlqLyIsInNvdXJjZXMiOlsidGltZWxpbmUvbnotdGltZWxpbmUtaXRlbS5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE9BQU8sRUFDTCx1QkFBdUIsRUFDdkIsaUJBQWlCLEVBQ2pCLFNBQVMsRUFDVCxVQUFVLEVBQ1YsS0FBSyxFQUdMLFNBQVMsRUFHVCxTQUFTLEVBQ1QsaUJBQWlCLEVBQ2xCLE1BQU0sZUFBZSxDQUFDO0FBV3ZCLE1BQU0sT0FBTyx1QkFBdUI7Ozs7O0lBUWxDLFlBQW9CLFFBQW1CLEVBQVUsR0FBc0I7UUFBbkQsYUFBUSxHQUFSLFFBQVEsQ0FBVztRQUFVLFFBQUcsR0FBSCxHQUFHLENBQW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