UNPKG

ng-zorro-antd-yj

Version:

An enterprise-class UI components based on Ant Design and Angular

139 lines 9.81 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import * as tslib_1 from "tslib"; import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core'; import { InputBoolean } from '../core/util/convert'; var NzSliderStepComponent = /** @class */ (function () { function NzSliderStepComponent() { this.nzLowerBound = null; this.nzUpperBound = null; this.nzVertical = false; this.nzIncluded = false; } /** * @param {?} changes * @return {?} */ NzSliderStepComponent.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { if (changes.nzMarksArray) { this.buildSteps(); } if (changes.nzMarksArray || changes.nzLowerBound || changes.nzUpperBound) { this.togglePointActive(); } }; /** * @param {?} _index * @param {?} step * @return {?} */ NzSliderStepComponent.prototype.trackById = /** * @param {?} _index * @param {?} step * @return {?} */ function (_index, step) { return step.value; }; /** * @private * @return {?} */ NzSliderStepComponent.prototype.buildSteps = /** * @private * @return {?} */ function () { /** @type {?} */ var orient = this.nzVertical ? 'bottom' : 'left'; this.steps = this.nzMarksArray.map((/** * @param {?} mark * @return {?} */ function (mark) { var _a; var value = mark.value, offset = mark.offset, config = mark.config; return { value: value, offset: offset, config: config, active: false, style: (_a = {}, _a[orient] = offset + "%", _a) }; })); }; /** * @private * @return {?} */ NzSliderStepComponent.prototype.togglePointActive = /** * @private * @return {?} */ function () { var _this = this; if (this.steps && this.nzLowerBound !== null && this.nzUpperBound !== null) { this.steps.forEach((/** * @param {?} step * @return {?} */ function (step) { /** @type {?} */ var value = step.value; /** @type {?} */ var isActive = (!_this.nzIncluded && value === _this.nzUpperBound) || (_this.nzIncluded && value <= (/** @type {?} */ (_this.nzUpperBound)) && value >= (/** @type {?} */ (_this.nzLowerBound))); step.active = isActive; })); } }; NzSliderStepComponent.decorators = [ { type: Component, args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: 'nz-slider-step', preserveWhitespaces: false, template: "<div class=\"ant-slider-step\">\n <span\n class=\"ant-slider-dot\"\n *ngFor=\"let mark of steps; trackBy: trackById\"\n [class.ant-slider-dot-active]=\"mark.active\"\n [ngStyle]=\"mark.style\">\n </span>\n</div>" }] } ]; NzSliderStepComponent.propDecorators = { nzLowerBound: [{ type: Input }], nzUpperBound: [{ type: Input }], nzMarksArray: [{ type: Input }], nzVertical: [{ type: Input }], nzIncluded: [{ type: Input }] }; tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzSliderStepComponent.prototype, "nzVertical", void 0); tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzSliderStepComponent.prototype, "nzIncluded", void 0); return NzSliderStepComponent; }()); export { NzSliderStepComponent }; if (false) { /** @type {?} */ NzSliderStepComponent.prototype.nzLowerBound; /** @type {?} */ NzSliderStepComponent.prototype.nzUpperBound; /** @type {?} */ NzSliderStepComponent.prototype.nzMarksArray; /** @type {?} */ NzSliderStepComponent.prototype.nzVertical; /** @type {?} */ NzSliderStepComponent.prototype.nzIncluded; /** @type {?} */ NzSliderStepComponent.prototype.steps; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotc2xpZGVyLXN0ZXAuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbInNsaWRlci9uei1zbGlkZXItc3RlcC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBNEIsaUJBQWlCLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFdkgsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBSXBEO0lBQUE7UUFRVyxpQkFBWSxH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