UNPKG

ng-zorro-antd-yj

Version:

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

68 lines 4.8 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import { Directive, ElementRef, Input, Optional, Renderer2, Self } from '@angular/core'; import { NgControl } from '@angular/forms'; import { toBoolean } from '../core/util/convert'; export class NzInputDirective { /** * @param {?} ngControl * @param {?} renderer * @param {?} elementRef */ constructor(ngControl, renderer, elementRef) { this.ngControl = ngControl; this._disabled = false; this.nzSize = 'default'; renderer.addClass(elementRef.nativeElement, 'ant-input'); } /** * @param {?} value * @return {?} */ set disabled(value) { this._disabled = toBoolean(value); } /** * @return {?} */ get disabled() { if (this.ngControl && this.ngControl.disabled !== null) { return this.ngControl.disabled; } return this._disabled; } } NzInputDirective.decorators = [ { type: Directive, args: [{ selector: '[nz-input]', host: { '[class.ant-input-disabled]': 'disabled', '[class.ant-input-lg]': `nzSize === 'large'`, '[class.ant-input-sm]': `nzSize === 'small'` } },] } ]; /** @nocollapse */ NzInputDirective.ctorParameters = () => [ { type: NgControl, decorators: [{ type: Optional }, { type: Self }] }, { type: Renderer2 }, { type: ElementRef } ]; NzInputDirective.propDecorators = { nzSize: [{ type: Input }], disabled: [{ type: Input }] }; if (false) { /** * @type {?} * @private */ NzInputDirective.prototype._disabled; /** @type {?} */ NzInputDirective.prototype.nzSize; /** @type {?} */ NzInputDirective.prototype.ngControl; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotaW5wdXQuZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbImlucHV0L256LWlucHV0LmRpcmVjdGl2ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxVQUFVLEVBQUUsS0FBSyxFQUFFLFF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