UNPKG

ng-zorro-antd

Version:

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

246 lines 30.2 kB
import { __decorate } from "tslib"; import { booleanAttribute, ChangeDetectionStrategy, Component, forwardRef, Inject, Input, Optional, ViewChild, ViewEncapsulation } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { fromEvent, Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { InputBoolean } from 'ng-zorro-antd/core/util'; import { NzRadioService } from './radio.service'; import * as i0 from "@angular/core"; import * as i1 from "@angular/cdk/a11y"; import * as i2 from "@angular/cdk/bidi"; import * as i3 from "ng-zorro-antd/core/form"; import * as i4 from "./radio.service"; export class NzRadioComponent { focus() { this.focusMonitor.focusVia(this.inputElement, 'keyboard'); } blur() { this.inputElement.nativeElement.blur(); } constructor(ngZone, elementRef, cdr, focusMonitor, directionality, nzRadioService, nzFormStatusService) { this.ngZone = ngZone; this.elementRef = elementRef; this.cdr = cdr; this.focusMonitor = focusMonitor; this.directionality = directionality; this.nzRadioService = nzRadioService; this.nzFormStatusService = nzFormStatusService; this.isNgModel = false; this.destroy$ = new Subject(); this.isNzDisableFirstChange = true; this.isChecked = false; this.name = null; this.onChange = () => { }; this.onTouched = () => { }; this.nzValue = null; this.nzDisabled = false; this.nzAutoFocus = false; this.isRadioButton = false; this.dir = 'ltr'; } setDisabledState(disabled) { this.nzDisabled = (this.isNzDisableFirstChange && this.nzDisabled) || disabled; this.isNzDisableFirstChange = false; this.cdr.markForCheck(); } writeValue(value) { this.isChecked = value; this.cdr.markForCheck(); } registerOnChange(fn) { this.isNgModel = true; this.onChange = fn; } registerOnTouched(fn) { this.onTouched = fn; } ngOnInit() { if (this.nzRadioService) { this.nzRadioService.name$.pipe(takeUntil(this.destroy$)).subscribe(name => { this.name = name; this.cdr.markForCheck(); }); this.nzRadioService.disabled$.pipe(takeUntil(this.destroy$)).subscribe(disabled => { this.nzDisabled = (this.isNzDisableFirstChange && this.nzDisabled) || disabled; this.isNzDisableFirstChange = false; this.cdr.markForCheck(); }); this.nzRadioService.selected$.pipe(takeUntil(this.destroy$)).subscribe(value => { const isChecked = this.isChecked; this.isChecked = this.nzValue === value; // We don't have to run `onChange()` on each `nz-radio` button whenever the `selected$` emits. // If we have 8 `nz-radio` buttons within the `nz-radio-group` and they're all connected with // `ngModel` or `formControl` then `onChange()` will be called 8 times for each `nz-radio` button. // We prevent this by checking if `isChecked` has been changed or not. if (this.isNgModel && isChecked !== this.isChecked && // We're only intereted if `isChecked` has been changed to `false` value to emit `false` to the ascendant form, // since we already emit `true` within the `setupClickListener`. this.isChecked === false) { this.onChange(false); } this.cdr.markForCheck(); }); } this.focusMonitor .monitor(this.elementRef, true) .pipe(takeUntil(this.destroy$)) .subscribe(focusOrigin => { if (!focusOrigin) { Promise.resolve().then(() => this.onTouched()); if (this.nzRadioService) { this.nzRadioService.touch(); } } }); this.directionality.change.pipe(takeUntil(this.destroy$)).subscribe((direction) => { this.dir = direction; this.cdr.detectChanges(); }); this.dir = this.directionality.value; this.setupClickListener(); } ngAfterViewInit() { if (this.nzAutoFocus) { this.focus(); } } ngOnDestroy() { this.destroy$.next(); this.destroy$.complete(); this.focusMonitor.stopMonitoring(this.elementRef); } setupClickListener() { this.ngZone.runOutsideAngular(() => { fromEvent(this.elementRef.nativeElement, 'click') .pipe(takeUntil(this.destroy$)) .subscribe(event => { /** prevent label click triggered twice. **/ event.stopPropagation(); event.preventDefault(); if (this.nzDisabled || this.isChecked) { return; } this.ngZone.run(() => { this.focus(); this.nzRadioService?.select(this.nzValue); if (this.isNgModel) { this.isChecked = true; this.onChange(true); } this.cdr.markForCheck(); }); }); }); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzRadioComponent, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.FocusMonitor }, { token: i2.Directionality, optional: true }, { token: NzRadioService, optional: true }, { token: i3.NzFormStatusService, optional: true }], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.3.4", type: NzRadioComponent, isStandalone: true, selector: "[nz-radio],[nz-radio-button]", inputs: { nzValue: "nzValue", nzDisabled: "nzDisabled", nzAutoFocus: "nzAutoFocus", isRadioButton: ["nz-radio-button", "isRadioButton", booleanAttribute] }, host: { properties: { "class.ant-radio-wrapper-in-form-item": "!!nzFormStatusService", "class.ant-radio-wrapper": "!isRadioButton", "class.ant-radio-button-wrapper": "isRadioButton", "class.ant-radio-wrapper-checked": "isChecked && !isRadioButton", "class.ant-radio-button-wrapper-checked": "isChecked && isRadioButton", "class.ant-radio-wrapper-disabled": "nzDisabled && !isRadioButton", "class.ant-radio-button-wrapper-disabled": "nzDisabled && isRadioButton", "class.ant-radio-wrapper-rtl": "!isRadioButton && dir === 'rtl'", "class.ant-radio-button-wrapper-rtl": "isRadioButton && dir === 'rtl'" } }, providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => NzRadioComponent), multi: true } ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, static: true }], exportAs: ["nzRadio"], ngImport: i0, template: ` <span [class.ant-radio]="!isRadioButton" [class.ant-radio-checked]="isChecked && !isRadioButton" [class.ant-radio-disabled]="nzDisabled && !isRadioButton" [class.ant-radio-button]="isRadioButton" [class.ant-radio-button-checked]="isChecked && isRadioButton" [class.ant-radio-button-disabled]="nzDisabled && isRadioButton" > <input #inputElement type="radio" [attr.autofocus]="nzAutoFocus ? 'autofocus' : null" [class.ant-radio-input]="!isRadioButton" [class.ant-radio-button-input]="isRadioButton" [disabled]="nzDisabled" [checked]="isChecked" [attr.name]="name" /> <span [class.ant-radio-inner]="!isRadioButton" [class.ant-radio-button-inner]="isRadioButton"></span> </span> <span><ng-content></ng-content></span> `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } } __decorate([ InputBoolean() ], NzRadioComponent.prototype, "nzDisabled", void 0); __decorate([ InputBoolean() ], NzRadioComponent.prototype, "nzAutoFocus", void 0); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzRadioComponent, decorators: [{ type: Component, args: [{ selector: '[nz-radio],[nz-radio-button]', exportAs: 'nzRadio', preserveWhitespaces: false, template: ` <span [class.ant-radio]="!isRadioButton" [class.ant-radio-checked]="isChecked && !isRadioButton" [class.ant-radio-disabled]="nzDisabled && !isRadioButton" [class.ant-radio-button]="isRadioButton" [class.ant-radio-button-checked]="isChecked && isRadioButton" [class.ant-radio-button-disabled]="nzDisabled && isRadioButton" > <input #inputElement type="radio" [attr.autofocus]="nzAutoFocus ? 'autofocus' : null" [class.ant-radio-input]="!isRadioButton" [class.ant-radio-button-input]="isRadioButton" [disabled]="nzDisabled" [checked]="isChecked" [attr.name]="name" /> <span [class.ant-radio-inner]="!isRadioButton" [class.ant-radio-button-inner]="isRadioButton"></span> </span> <span><ng-content></ng-content></span> `, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => NzRadioComponent), multi: true } ], host: { '[class.ant-radio-wrapper-in-form-item]': '!!nzFormStatusService', '[class.ant-radio-wrapper]': '!isRadioButton', '[class.ant-radio-button-wrapper]': 'isRadioButton', '[class.ant-radio-wrapper-checked]': 'isChecked && !isRadioButton', '[class.ant-radio-button-wrapper-checked]': 'isChecked && isRadioButton', '[class.ant-radio-wrapper-disabled]': 'nzDisabled && !isRadioButton', '[class.ant-radio-button-wrapper-disabled]': 'nzDisabled && isRadioButton', '[class.ant-radio-wrapper-rtl]': `!isRadioButton && dir === 'rtl'`, '[class.ant-radio-button-wrapper-rtl]': `isRadioButton && dir === 'rtl'` }, standalone: true }] }], ctorParameters: () => [{ type: i0.NgZone }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.FocusMonitor }, { type: i2.Directionality, decorators: [{ type: Optional }] }, { type: i4.NzRadioService, decorators: [{ type: Optional }, { type: Inject, args: [NzRadioService] }] }, { type: i3.NzFormStatusService, decorators: [{ type: Optional }] }], propDecorators: { inputElement: [{ type: ViewChild, args: ['inputElement', { static: true }] }], nzValue: [{ type: Input }], nzDisabled: [{ type: Input }], nzAutoFocus: [{ type: Input }], isRadioButton: [{ type: Input, args: [{ alias: 'nz-radio-button', transform: booleanAttribute }] }] } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmFkaW8uY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vY29tcG9uZW50cy9yYWRpby9yYWRpby5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQU9BLE9BQU8sRUFFTCxnQkFBZ0IsRUFDaEIsdUJBQXVCLEVBRXZCLFNBQVMsRUFFVCxVQUFVLEVBQ1YsTUFBTSxFQUNOLEtBQUssRUFJTCxRQUFRLEVBQ1IsU0FBUyxFQUNULGlCQUFpQixFQUNsQixNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQXdCLGlCQUFpQixFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDekUsT0FBTyxFQUFFLFNBQVMsRUFBRSxPQUFPLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFDMUMsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBSTNDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUV2RCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0saUJBQWlCLENBQUM7Ozs7OztBQW1EakQsTUFBTSxPQUFPLGdCQUFnQjtJQW1CM0IsS0FBSztRQUNILElBQUksQ0FBQyxZQUFZLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxZQUFhLEVB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