ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
273 lines • 19.8 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { forwardRef, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, ElementRef, Input, QueryList, Renderer2, ViewEncapsulation } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { merge, Subject } from 'rxjs';
import { startWith, takeUntil } from 'rxjs/operators';
import { isNotNil } from '../core/util/check';
import { InputBoolean } from '../core/util/convert';
import { NzRadioComponent } from './nz-radio.component';
var NzRadioGroupComponent = /** @class */ (function () {
function NzRadioGroupComponent(cdr, renderer, elementRef) {
this.cdr = cdr;
this.destroy$ = new Subject();
this.onChange = (/**
* @return {?}
*/
function () { return null; });
this.onTouched = (/**
* @return {?}
*/
function () { return null; });
this.nzButtonStyle = 'outline';
this.nzSize = 'default';
renderer.addClass(elementRef.nativeElement, 'ant-radio-group');
}
/**
* @return {?}
*/
NzRadioGroupComponent.prototype.updateChildrenStatus = /**
* @return {?}
*/
function () {
var _this = this;
if (this.radios) {
Promise.resolve().then((/**
* @return {?}
*/
function () {
_this.radios.forEach((/**
* @param {?} radio
* @return {?}
*/
function (radio) {
radio.checked = radio.nzValue === _this.value;
if (isNotNil(_this.nzDisabled)) {
radio.nzDisabled = _this.nzDisabled;
}
if (_this.nzName) {
radio.name = _this.nzName;
}
radio.markForCheck();
}));
}));
}
};
/**
* @return {?}
*/
NzRadioGroupComponent.prototype.ngAfterContentInit = /**
* @return {?}
*/
function () {
var _this = this;
this.radios.changes
.pipe(startWith(null), takeUntil(this.destroy$))
.subscribe((/**
* @return {?}
*/
function () {
_this.updateChildrenStatus();
if (_this.selectSubscription) {
_this.selectSubscription.unsubscribe();
}
_this.selectSubscription = merge.apply(void 0, tslib_1.__spread(_this.radios.map((/**
* @param {?} radio
* @return {?}
*/
function (radio) { return radio.select$; })))).pipe(takeUntil(_this.destroy$))
.subscribe((/**
* @param {?} radio
* @return {?}
*/
function (radio) {
if (_this.value !== radio.nzValue) {
_this.value = radio.nzValue;
_this.updateChildrenStatus();
_this.onChange(_this.value);
}
}));
if (_this.touchedSubscription) {
_this.touchedSubscription.unsubscribe();
}
_this.touchedSubscription = merge.apply(void 0, tslib_1.__spread(_this.radios.map((/**
* @param {?} radio
* @return {?}
*/
function (radio) { return radio.touched$; })))).pipe(takeUntil(_this.destroy$))
.subscribe((/**
* @return {?}
*/
function () {
Promise.resolve().then((/**
* @return {?}
*/
function () { return _this.onTouched(); }));
}));
}));
};
/**
* @param {?} changes
* @return {?}
*/
NzRadioGroupComponent.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if (changes.nzDisabled || changes.nzName) {
this.updateChildrenStatus();
}
};
/**
* @return {?}
*/
NzRadioGroupComponent.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.destroy$.next();
this.destroy$.complete();
};
/* tslint:disable-next-line:no-any */
/* tslint:disable-next-line:no-any */
/**
* @param {?} value
* @return {?}
*/
NzRadioGroupComponent.prototype.writeValue = /* tslint:disable-next-line:no-any */
/**
* @param {?} value
* @return {?}
*/
function (value) {
this.value = value;
this.updateChildrenStatus();
this.cdr.markForCheck();
};
/**
* @param {?} fn
* @return {?}
*/
NzRadioGroupComponent.prototype.registerOnChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this.onChange = fn;
};
/**
* @param {?} fn
* @return {?}
*/
NzRadioGroupComponent.prototype.registerOnTouched = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this.onTouched = fn;
};
/**
* @param {?} isDisabled
* @return {?}
*/
NzRadioGroupComponent.prototype.setDisabledState = /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) {
this.nzDisabled = isDisabled;
this.cdr.markForCheck();
};
NzRadioGroupComponent.decorators = [
{ type: Component, args: [{
selector: 'nz-radio-group',
preserveWhitespaces: false,
template: "<ng-content></ng-content>",
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef((/**
* @return {?}
*/
function () { return NzRadioGroupComponent; })),
multi: true
}
],
host: {
'[class.ant-radio-group-large]': "nzSize === 'large'",
'[class.ant-radio-group-small]': "nzSize === 'small'",
'[class.ant-radio-group-solid]': "nzButtonStyle === 'solid'"
}
}] }
];
/** @nocollapse */
NzRadioGroupComponent.ctorParameters = function () { return [
{ type: ChangeDetectorRef },
{ type: Renderer2 },
{ type: ElementRef }
]; };
NzRadioGroupComponent.propDecorators = {
radios: [{ type: ContentChildren, args: [forwardRef((/**
* @return {?}
*/
function () { return NzRadioComponent; })), { descendants: true },] }],
nzDisabled: [{ type: Input }],
nzButtonStyle: [{ type: Input }],
nzSize: [{ type: Input }],
nzName: [{ type: Input }]
};
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Boolean)
], NzRadioGroupComponent.prototype, "nzDisabled", void 0);
return NzRadioGroupComponent;
}());
export { NzRadioGroupComponent };
if (false) {
/**
* @type {?}
* @private
*/
NzRadioGroupComponent.prototype.value;
/**
* @type {?}
* @private
*/
NzRadioGroupComponent.prototype.destroy$;
/**
* @type {?}
* @private
*/
NzRadioGroupComponent.prototype.selectSubscription;
/**
* @type {?}
* @private
*/
NzRadioGroupComponent.prototype.touchedSubscription;
/** @type {?} */
NzRadioGroupComponent.prototype.onChange;
/** @type {?} */
NzRadioGroupComponent.prototype.onTouched;
/** @type {?} */
NzRadioGroupComponent.prototype.radios;
/** @type {?} */
NzRadioGroupComponent.prototype.nzDisabled;
/** @type {?} */
NzRadioGroupComponent.prototype.nzButtonStyle;
/** @type {?} */
NzRadioGroupComponent.prototype.nzSize;
/** @type {?} */
NzRadioGroupComponent.prototype.nzName;
/**
* @type {?}
* @private
*/
NzRadioGroupComponent.prototype.cdr;
}
//# sourceMappingURL=data:application/json;base64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