ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
272 lines • 17.7 kB
JavaScript
/**
* @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, HostListener, Input, Renderer2, ViewChild, ViewEncapsulation } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { Subject } from 'rxjs';
import { InputBoolean } from '../core/util/convert';
var NzRadioComponent = /** @class */ (function () {
/* tslint:disable-next-line:no-any */
function NzRadioComponent(elementRef, renderer, cdr, focusMonitor) {
this.elementRef = elementRef;
this.renderer = renderer;
this.cdr = cdr;
this.focusMonitor = focusMonitor;
this.select$ = new Subject();
this.touched$ = new Subject();
this.checked = false;
this.isNgModel = false;
this.onChange = (/**
* @return {?}
*/
function () { return null; });
this.onTouched = (/**
* @return {?}
*/
function () { return null; });
this.nzDisabled = false;
this.nzAutoFocus = false;
this.renderer.addClass(elementRef.nativeElement, 'ant-radio-wrapper');
}
/**
* @return {?}
*/
NzRadioComponent.prototype.updateAutoFocus = /**
* @return {?}
*/
function () {
if (this.inputElement) {
if (this.nzAutoFocus) {
this.renderer.setAttribute(this.inputElement.nativeElement, 'autofocus', 'autofocus');
}
else {
this.renderer.removeAttribute(this.inputElement.nativeElement, 'autofocus');
}
}
};
/**
* @param {?} event
* @return {?}
*/
NzRadioComponent.prototype.onClick = /**
* @param {?} event
* @return {?}
*/
function (event) {
// Prevent label click triggered twice.
event.stopPropagation();
event.preventDefault();
if (!this.nzDisabled && !this.checked) {
this.select$.next(this);
if (this.isNgModel) {
this.checked = true;
this.onChange(true);
}
}
};
/**
* @return {?}
*/
NzRadioComponent.prototype.focus = /**
* @return {?}
*/
function () {
this.focusMonitor.focusVia(this.inputElement, 'keyboard');
};
/**
* @return {?}
*/
NzRadioComponent.prototype.blur = /**
* @return {?}
*/
function () {
this.inputElement.nativeElement.blur();
};
/**
* @return {?}
*/
NzRadioComponent.prototype.markForCheck = /**
* @return {?}
*/
function () {
this.cdr.markForCheck();
};
/**
* @param {?} isDisabled
* @return {?}
*/
NzRadioComponent.prototype.setDisabledState = /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) {
this.nzDisabled = isDisabled;
this.cdr.markForCheck();
};
/**
* @param {?} value
* @return {?}
*/
NzRadioComponent.prototype.writeValue = /**
* @param {?} value
* @return {?}
*/
function (value) {
this.checked = value;
this.cdr.markForCheck();
};
/**
* @param {?} fn
* @return {?}
*/
NzRadioComponent.prototype.registerOnChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this.isNgModel = true;
this.onChange = fn;
};
/**
* @param {?} fn
* @return {?}
*/
NzRadioComponent.prototype.registerOnTouched = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this.onTouched = fn;
};
/**
* @return {?}
*/
NzRadioComponent.prototype.ngAfterViewInit = /**
* @return {?}
*/
function () {
var _this = this;
this.focusMonitor.monitor(this.elementRef, true).subscribe((/**
* @param {?} focusOrigin
* @return {?}
*/
function (focusOrigin) {
if (!focusOrigin) {
Promise.resolve().then((/**
* @return {?}
*/
function () { return _this.onTouched(); }));
_this.touched$.next();
}
}));
this.updateAutoFocus();
};
/**
* @param {?} changes
* @return {?}
*/
NzRadioComponent.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if (changes.nzAutoFocus) {
this.updateAutoFocus();
}
};
NzRadioComponent.decorators = [
{ type: Component, args: [{
selector: '[nz-radio]',
preserveWhitespaces: false,
template: "<span class=\"ant-radio\" [class.ant-radio-checked]=\"checked\" [class.ant-radio-disabled]=\"nzDisabled\">\n <input #inputElement type=\"radio\" class=\"ant-radio-input\" [disabled]=\"nzDisabled\" [checked]=\"checked\" [attr.name]=\"name\">\n <span class=\"ant-radio-inner\"></span>\n</span>\n<span><ng-content></ng-content></span>",
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef((/**
* @return {?}
*/
function () { return NzRadioComponent; })),
multi: true
}
],
host: {
'[class.ant-radio-wrapper-checked]': 'checked',
'[class.ant-radio-wrapper-disabled]': 'nzDisabled'
}
}] }
];
/** @nocollapse */
NzRadioComponent.ctorParameters = function () { return [
{ type: ElementRef },
{ type: Renderer2 },
{ type: ChangeDetectorRef },
{ type: FocusMonitor }
]; };
NzRadioComponent.propDecorators = {
inputElement: [{ type: ViewChild, args: ['inputElement',] }],
nzValue: [{ type: Input }],
nzDisabled: [{ type: Input }],
nzAutoFocus: [{ type: Input }],
onClick: [{ type: HostListener, args: ['click', ['$event'],] }]
};
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzRadioComponent.prototype, "nzDisabled", void 0);
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzRadioComponent.prototype, "nzAutoFocus", void 0);
return NzRadioComponent;
}());
export { NzRadioComponent };
if (false) {
/** @type {?} */
NzRadioComponent.prototype.select$;
/** @type {?} */
NzRadioComponent.prototype.touched$;
/** @type {?} */
NzRadioComponent.prototype.checked;
/** @type {?} */
NzRadioComponent.prototype.name;
/** @type {?} */
NzRadioComponent.prototype.isNgModel;
/** @type {?} */
NzRadioComponent.prototype.onChange;
/** @type {?} */
NzRadioComponent.prototype.onTouched;
/** @type {?} */
NzRadioComponent.prototype.inputElement;
/** @type {?} */
NzRadioComponent.prototype.nzValue;
/** @type {?} */
NzRadioComponent.prototype.nzDisabled;
/** @type {?} */
NzRadioComponent.prototype.nzAutoFocus;
/**
* @type {?}
* @private
*/
NzRadioComponent.prototype.elementRef;
/**
* @type {?}
* @private
*/
NzRadioComponent.prototype.renderer;
/**
* @type {?}
* @private
*/
NzRadioComponent.prototype.cdr;
/**
* @type {?}
* @private
*/
NzRadioComponent.prototype.focusMonitor;
}
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