ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
192 lines • 11.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, ChangeDetectorRef, Component, ElementRef, Input, Renderer2, ViewEncapsulation } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { InputBoolean } from '../core/util/convert';
/**
* @record
*/
export function NzCheckBoxOptionInterface() { }
if (false) {
/** @type {?} */
NzCheckBoxOptionInterface.prototype.label;
/** @type {?} */
NzCheckBoxOptionInterface.prototype.value;
/** @type {?|undefined} */
NzCheckBoxOptionInterface.prototype.checked;
/** @type {?|undefined} */
NzCheckBoxOptionInterface.prototype.disabled;
}
var NzCheckboxGroupComponent = /** @class */ (function () {
function NzCheckboxGroupComponent(elementRef, focusMonitor, cdr, renderer) {
this.elementRef = elementRef;
this.focusMonitor = focusMonitor;
this.cdr = cdr;
// tslint:disable-next-line:no-any
this.onChange = (/**
* @return {?}
*/
function () { return null; });
// tslint:disable-next-line:no-any
this.onTouched = (/**
* @return {?}
*/
function () { return null; });
this.options = [];
this.nzDisabled = false;
renderer.addClass(elementRef.nativeElement, 'ant-checkbox-group');
}
/**
* @return {?}
*/
NzCheckboxGroupComponent.prototype.onOptionChange = /**
* @return {?}
*/
function () {
this.onChange(this.options);
};
/**
* @param {?} _index
* @param {?} option
* @return {?}
*/
NzCheckboxGroupComponent.prototype.trackByOption = /**
* @param {?} _index
* @param {?} option
* @return {?}
*/
function (_index, option) {
return option.value;
};
/**
* @return {?}
*/
NzCheckboxGroupComponent.prototype.ngOnInit = /**
* @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(); }));
}
}));
};
/**
* @param {?} value
* @return {?}
*/
NzCheckboxGroupComponent.prototype.writeValue = /**
* @param {?} value
* @return {?}
*/
function (value) {
this.options = value;
this.cdr.markForCheck();
};
/**
* @param {?} fn
* @return {?}
*/
NzCheckboxGroupComponent.prototype.registerOnChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this.onChange = fn;
};
/**
* @param {?} fn
* @return {?}
*/
NzCheckboxGroupComponent.prototype.registerOnTouched = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this.onTouched = fn;
};
/**
* @param {?} isDisabled
* @return {?}
*/
NzCheckboxGroupComponent.prototype.setDisabledState = /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) {
this.nzDisabled = isDisabled;
this.cdr.markForCheck();
};
NzCheckboxGroupComponent.decorators = [
{ type: Component, args: [{
selector: 'nz-checkbox-group',
preserveWhitespaces: false,
encapsulation: ViewEncapsulation.None,
template: "<label nz-checkbox\n *ngFor=\"let option of options; trackBy:trackByOption\"\n [nzDisabled]=\"option.disabled || nzDisabled\"\n [(nzChecked)]=\"option.checked\"\n (nzCheckedChange)=\"onOptionChange()\">\n <span>{{ option.label }}</span>\n</label>",
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef((/**
* @return {?}
*/
function () { return NzCheckboxGroupComponent; })),
multi: true
}
]
}] }
];
/** @nocollapse */
NzCheckboxGroupComponent.ctorParameters = function () { return [
{ type: ElementRef },
{ type: FocusMonitor },
{ type: ChangeDetectorRef },
{ type: Renderer2 }
]; };
NzCheckboxGroupComponent.propDecorators = {
nzDisabled: [{ type: Input }]
};
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzCheckboxGroupComponent.prototype, "nzDisabled", void 0);
return NzCheckboxGroupComponent;
}());
export { NzCheckboxGroupComponent };
if (false) {
/** @type {?} */
NzCheckboxGroupComponent.prototype.onChange;
/** @type {?} */
NzCheckboxGroupComponent.prototype.onTouched;
/** @type {?} */
NzCheckboxGroupComponent.prototype.options;
/** @type {?} */
NzCheckboxGroupComponent.prototype.nzDisabled;
/**
* @type {?}
* @private
*/
NzCheckboxGroupComponent.prototype.elementRef;
/**
* @type {?}
* @private
*/
NzCheckboxGroupComponent.prototype.focusMonitor;
/**
* @type {?}
* @private
*/
NzCheckboxGroupComponent.prototype.cdr;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotY2hlY2tib3gtZ3JvdXAuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbImNoZWNrYm94L256LWNoZWNrYm94LWdyb3VwLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUNqRCxPQUFPLEVBQ0wsVUFBVSxFQUNWLGlCQUFpQixFQUNqQixTQUFTLEVBQ1QsVUFBVSxFQUNWLEtBQUssRUFFTCxTQUFTLEVBQ1QsaUJBQWlCLEVBQ2xCLE1BQU0sZUFBZSxDQUFDO0FBQ3ZCLE9BQU8sRUFBd0IsaUJBQWlCLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUN6RSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7Ozs7QUFFcEQsK0NBS0M7OztJQUpDLDBDQUFjOztJQUNkLDBDQUFjOztJQUNkLDRDQUFrQjs7SUFDbEIsNkNBQW1COztBQUdyQjtJQTZCRSxrQ0FDVSxVQUFzQixFQUN0QixZQUEwQixFQUMxQixHQUFzQixFQUM5QixRQUFtQjtRQUhYLGVBQVUsR0FBVixVQUFVLENBQVk7UUFDdEIsaUJBQVksR0FBWixZQUFZLENBQWM7UUFDMUIsUUFBRyxHQUFILEdBQUcsQ0FBbUI7O1FBakJoQyxhQUFROzs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