UNPKG

ng-zorro-antd-yj

Version:

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

285 lines 20.2 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import * as tslib_1 from "tslib"; import { FocusMonitor } from '@angular/cdk/a11y'; import { forwardRef, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, Optional, Output, Renderer2, ViewChild, ViewEncapsulation } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { isEmpty } from '../core/util/check'; import { InputBoolean } from '../core/util/convert'; import { NzCheckboxWrapperComponent } from './nz-checkbox-wrapper.component'; export class NzCheckboxComponent { /** * @param {?} elementRef * @param {?} renderer * @param {?} nzCheckboxWrapperComponent * @param {?} cdr * @param {?} focusMonitor */ constructor(elementRef, renderer, nzCheckboxWrapperComponent, cdr, focusMonitor) { this.elementRef = elementRef; this.renderer = renderer; this.nzCheckboxWrapperComponent = nzCheckboxWrapperComponent; this.cdr = cdr; this.focusMonitor = focusMonitor; // tslint:disable-next-line:no-any this.onChange = (/** * @return {?} */ () => null); // tslint:disable-next-line:no-any this.onTouched = (/** * @return {?} */ () => null); this.nzCheckedChange = new EventEmitter(); this.nzAutoFocus = false; this.nzDisabled = false; this.nzIndeterminate = false; this.nzChecked = false; renderer.addClass(elementRef.nativeElement, 'ant-checkbox-wrapper'); } /** * @param {?} e * @return {?} */ hostClick(e) { e.preventDefault(); this.focus(); this.innerCheckedChange(!this.nzChecked); } /** * @param {?} checked * @return {?} */ innerCheckedChange(checked) { if (!this.nzDisabled) { this.nzChecked = checked; this.onChange(this.nzChecked); this.nzCheckedChange.emit(this.nzChecked); if (this.nzCheckboxWrapperComponent) { this.nzCheckboxWrapperComponent.onChange(); } } } /** * @return {?} */ updateAutoFocus() { if (this.inputElement && this.nzAutoFocus) { this.renderer.setAttribute(this.inputElement.nativeElement, 'autofocus', 'autofocus'); } else { this.renderer.removeAttribute(this.inputElement.nativeElement, 'autofocus'); } } /** * @param {?} value * @return {?} */ writeValue(value) { this.nzChecked = value; this.cdr.markForCheck(); } /** * @param {?} fn * @return {?} */ registerOnChange(fn) { this.onChange = fn; } /** * @param {?} fn * @return {?} */ registerOnTouched(fn) { this.onTouched = fn; } /** * @param {?} isDisabled * @return {?} */ setDisabledState(isDisabled) { this.nzDisabled = isDisabled; this.cdr.markForCheck(); } /** * @return {?} */ focus() { this.focusMonitor.focusVia(this.inputElement, 'keyboard'); } /** * @return {?} */ blur() { this.inputElement.nativeElement.blur(); } /** * @return {?} */ checkContent() { if (isEmpty(this.contentElement.nativeElement)) { this.renderer.setStyle(this.contentElement.nativeElement, 'display', 'none'); } else { this.renderer.removeStyle(this.contentElement.nativeElement, 'display'); } } /** * @return {?} */ ngOnInit() { this.focusMonitor.monitor(this.elementRef, true).subscribe((/** * @param {?} focusOrigin * @return {?} */ focusOrigin => { if (!focusOrigin) { Promise.resolve().then((/** * @return {?} */ () => this.onTouched())); } })); if (this.nzCheckboxWrapperComponent) { this.nzCheckboxWrapperComponent.addCheckbox(this); } } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { if (changes.nzAutoFocus) { this.updateAutoFocus(); } } /** * @return {?} */ ngAfterViewInit() { this.updateAutoFocus(); this.checkContent(); } /** * @return {?} */ ngOnDestroy() { this.focusMonitor.stopMonitoring(this.elementRef); if (this.nzCheckboxWrapperComponent) { this.nzCheckboxWrapperComponent.removeCheckbox(this); } } } NzCheckboxComponent.decorators = [ { type: Component, args: [{ selector: '[nz-checkbox]', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<span class=\"ant-checkbox\"\n [class.ant-checkbox-checked]=\"nzChecked && !nzIndeterminate\"\n [class.ant-checkbox-disabled]=\"nzDisabled\"\n [class.ant-checkbox-indeterminate]=\"nzIndeterminate\">\n <input #inputElement [checked]=\"nzChecked\" [ngModel]=\"nzChecked\" [disabled]=\"nzDisabled\" (ngModelChange)=\"innerCheckedChange($event)\" (click)=\"$event.stopPropagation();\" type=\"checkbox\" class=\"ant-checkbox-input\">\n <span class=\"ant-checkbox-inner\"></span>\n</span>\n<span #contentElement (cdkObserveContent)=\"checkContent()\"><ng-content></ng-content></span>", providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((/** * @return {?} */ () => NzCheckboxComponent)), multi: true } ], host: { '(click)': 'hostClick($event)' } }] } ]; /** @nocollapse */ NzCheckboxComponent.ctorParameters = () => [ { type: ElementRef }, { type: Renderer2 }, { type: NzCheckboxWrapperComponent, decorators: [{ type: Optional }] }, { type: ChangeDetectorRef }, { type: FocusMonitor } ]; NzCheckboxComponent.propDecorators = { inputElement: [{ type: ViewChild, args: ['inputElement',] }], contentElement: [{ type: ViewChild, args: ['contentElement',] }], nzCheckedChange: [{ type: Output }], nzValue: [{ type: Input }], nzAutoFocus: [{ type: Input }], nzDisabled: [{ type: Input }], nzIndeterminate: [{ type: Input }], nzChecked: [{ type: Input }] }; tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzCheckboxComponent.prototype, "nzAutoFocus", void 0); tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzCheckboxComponent.prototype, "nzDisabled", void 0); tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzCheckboxComponent.prototype, "nzIndeterminate", void 0); tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzCheckboxComponent.prototype, "nzChecked", void 0); if (false) { /** @type {?} */ NzCheckboxComponent.prototype.onChange; /** @type {?} */ NzCheckboxComponent.prototype.onTouched; /** * @type {?} * @private */ NzCheckboxComponent.prototype.inputElement; /** * @type {?} * @private */ NzCheckboxComponent.prototype.contentElement; /** @type {?} */ NzCheckboxComponent.prototype.nzCheckedChange; /** @type {?} */ NzCheckboxComponent.prototype.nzValue; /** @type {?} */ NzCheckboxComponent.prototype.nzAutoFocus; /** @type {?} */ NzCheckboxComponent.prototype.nzDisabled; /** @type {?} */ NzCheckboxComponent.prototype.nzIndeterminate; /** @type {?} */ NzCheckboxComponent.prototype.nzChecked; /** * @type {?} * @private */ NzCheckboxComponent.prototype.elementRef; /** * @type {?} * @private */ NzCheckboxComponent.prototype.renderer; /** * @type {?} * @private */ NzCheckboxComponent.prototype.nzCheckboxWrapperComponent; /** * @type {?} * @private */ NzCheckboxComponent.prototype.cdr; /** * @type {?} * @private */ NzCheckboxComponent.prototype.focusMonitor; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotY2hlY2tib3guY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbImNoZWNrYm94L256LWNoZWNrYm94LmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUNqRCxPQUFPLEVBQ0wsVUFBVSxFQUVWLHVCQUF1QixFQUN2QixpQkFBaUIsRUFDakIsU0FBUyxFQUNULFVBQVUsRUFDVixZQUFZLEVBQ1osS0FBSyxFQUlMLFFBQVEsRUFDUixNQUFNLEVBQ04sU0FBUyxFQUVULFNBQVMsRUFDVCxpQkFBaUIsRUFDbEIsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUF3QixpQkFBaUIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ3pFLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUM3QyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDcEQsT0FBTyxFQUFFLDBCQUEwQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFtQjdFLE1BQU0sT0FBTyxtQkFBbUI7Ozs7Ozs7O0lBeUU5Qix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