ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
160 lines • 12.9 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Input, Renderer2, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core';
export class NzStepComponent {
/**
* @param {?} cdr
* @param {?} renderer
* @param {?} elementRef
*/
constructor(cdr, renderer, elementRef) {
this.cdr = cdr;
this.isCustomStatus = false;
this._status = 'wait';
this.oldAPIIcon = true;
this.isIconString = true;
// Set by parent.
this.direction = 'horizontal';
this.index = 0;
this.last = false;
this.outStatus = 'process';
this.showProcessDot = false;
this._currentIndex = 0;
renderer.addClass(elementRef.nativeElement, 'ant-steps-item');
}
/**
* @return {?}
*/
get nzStatus() {
return this._status;
}
/**
* @param {?} status
* @return {?}
*/
set nzStatus(status) {
this._status = status;
this.isCustomStatus = true;
}
/**
* @return {?}
*/
get nzIcon() {
return this._icon;
}
/**
* @param {?} value
* @return {?}
*/
set nzIcon(value) {
if (!(value instanceof TemplateRef)) {
this.isIconString = true;
this.oldAPIIcon = typeof value === 'string' && value.indexOf('anticon') > -1;
}
else {
this.isIconString = false;
}
this._icon = value;
}
/**
* @return {?}
*/
get currentIndex() {
return this._currentIndex;
}
/**
* @param {?} current
* @return {?}
*/
set currentIndex(current) {
this._currentIndex = current;
if (!this.isCustomStatus) {
this._status = current > this.index ? 'finish' : current === this.index ? this.outStatus || '' : 'wait';
}
}
/**
* @return {?}
*/
markForCheck() {
this.cdr.markForCheck();
}
}
NzStepComponent.decorators = [
{ type: Component, args: [{
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
selector: 'nz-step',
preserveWhitespaces: false,
template: "<div class=\"ant-steps-item-tail\" *ngIf=\"last !== true\"></div>\n<div class=\"ant-steps-item-icon\">\n <ng-template [ngIf]=\"!showProcessDot\">\n <span class=\"ant-steps-icon\" *ngIf=\"nzStatus === 'finish' && !nzIcon\"><i nz-icon type=\"check\"></i></span>\n <span class=\"ant-steps-icon\" *ngIf=\"nzStatus === 'error'\"><i nz-icon type=\"close\"></i></span>\n <span class=\"ant-steps-icon\" *ngIf=\"(nzStatus === 'process' || nzStatus === 'wait') && !nzIcon\">{{ index + 1 }}</span>\n <span class=\"ant-steps-icon\" *ngIf=\"nzIcon\">\n <ng-container *ngIf=\"isIconString; else iconTemplate\">\n <i nz-icon [type]=\"!oldAPIIcon && nzIcon\" [ngClass]=\"oldAPIIcon && nzIcon\"></i>\n </ng-container>\n <ng-template #iconTemplate>\n <ng-template [ngTemplateOutlet]=\"nzIcon\"></ng-template>\n </ng-template>\n </span>\n </ng-template>\n <ng-template [ngIf]=\"showProcessDot\">\n <span class=\"ant-steps-icon\">\n <ng-template #processDotTemplate>\n <span class=\"ant-steps-icon-dot\"></span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"customProcessTemplate||processDotTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: processDotTemplate, status:nzStatus, index:index }\">\n </ng-template>\n </span>\n </ng-template>\n</div>\n<div class=\"ant-steps-item-content\">\n <div class=\"ant-steps-item-title\">\n <ng-container *nzStringTemplateOutlet=\"nzTitle\">{{ nzTitle }}</ng-container>\n </div>\n <div class=\"ant-steps-item-description\">\n <ng-container *nzStringTemplateOutlet=\"nzDescription\">{{ nzDescription }}</ng-container>\n </div>\n</div>\n",
host: {
'[class.ant-steps-item-wait]': 'nzStatus === "wait"',
'[class.ant-steps-item-process]': 'nzStatus === "process"',
'[class.ant-steps-item-finish]': 'nzStatus === "finish"',
'[class.ant-steps-item-error]': 'nzStatus === "error"',
'[class.ant-steps-custom]': '!!nzIcon',
'[class.ant-steps-next-error]': '(outStatus === "error") && (currentIndex === index + 1)'
}
}] }
];
/** @nocollapse */
NzStepComponent.ctorParameters = () => [
{ type: ChangeDetectorRef },
{ type: Renderer2 },
{ type: ElementRef }
];
NzStepComponent.propDecorators = {
processDotTemplate: [{ type: ViewChild, args: ['processDotTemplate',] }],
nzTitle: [{ type: Input }],
nzDescription: [{ type: Input }],
nzStatus: [{ type: Input }],
nzIcon: [{ type: Input }]
};
if (false) {
/** @type {?} */
NzStepComponent.prototype.processDotTemplate;
/** @type {?} */
NzStepComponent.prototype.nzTitle;
/** @type {?} */
NzStepComponent.prototype.nzDescription;
/** @type {?} */
NzStepComponent.prototype.isCustomStatus;
/**
* @type {?}
* @private
*/
NzStepComponent.prototype._status;
/** @type {?} */
NzStepComponent.prototype.oldAPIIcon;
/** @type {?} */
NzStepComponent.prototype.isIconString;
/**
* @type {?}
* @private
*/
NzStepComponent.prototype._icon;
/** @type {?} */
NzStepComponent.prototype.customProcessTemplate;
/** @type {?} */
NzStepComponent.prototype.direction;
/** @type {?} */
NzStepComponent.prototype.index;
/** @type {?} */
NzStepComponent.prototype.last;
/** @type {?} */
NzStepComponent.prototype.outStatus;
/** @type {?} */
NzStepComponent.prototype.showProcessDot;
/**
* @type {?}
* @private
*/
NzStepComponent.prototype._currentIndex;
/**
* @type {?}
* @private
*/
NzStepComponent.prototype.cdr;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotc3RlcC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZy16b3Jyby1hbnRkLXlqLyIsInNvdXJjZXMiOlsic3RlcHMvbnotc3RlcC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE9BQU8sRUFDTCx1QkFBdUIsRUFDdkIsaUJBQWlCLEVBQ2pCLFNBQVMsRUFDVCxVQUFVLEVBQ1YsS0FBSyxFQUNMLFNBQVMsRUFDVCxXQUFXLEVBQ1gsU0FBUyxFQUNULGlCQUFpQixFQUNsQixNQUFNLGVBQWUsQ0FBQztBQW1CdkIsTUFBTSxPQUFPLGVBQWU7Ozs7OztJQTBEMUI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