UNPKG

ng-zorro-antd

Version:

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

113 lines (104 loc) 6.1 kB
import * as i0 from '@angular/core'; import { inject, ChangeDetectorRef, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, Injectable, InjectionToken } from '@angular/core'; import * as i1 from 'ng-zorro-antd/icon'; import { NzIconModule } from 'ng-zorro-antd/icon'; import { BehaviorSubject, ReplaySubject } from 'rxjs'; /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ const iconTypeMap = { error: 'close-circle-fill', validating: 'loading', success: 'check-circle-fill', warning: 'exclamation-circle-fill' }; class NzFormItemFeedbackIconComponent { cdr = inject(ChangeDetectorRef); status = ''; iconType = null; ngOnChanges(_changes) { this.updateIcon(); } updateIcon() { this.iconType = this.status ? iconTypeMap[this.status] : null; this.cdr.markForCheck(); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NzFormItemFeedbackIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: NzFormItemFeedbackIconComponent, isStandalone: true, selector: "nz-form-item-feedback-icon", inputs: { status: "status" }, host: { properties: { "class.ant-form-item-feedback-icon-error": "status===\"error\"", "class.ant-form-item-feedback-icon-warning": "status===\"warning\"", "class.ant-form-item-feedback-icon-success": "status===\"success\"", "class.ant-form-item-feedback-icon-validating": "status===\"validating\"" }, classAttribute: "ant-form-item-feedback-icon" }, exportAs: ["nzFormFeedbackIcon"], usesOnChanges: true, ngImport: i0, template: ` @if (iconType) { <nz-icon [nzType]="iconType" /> } `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NzFormItemFeedbackIconComponent, decorators: [{ type: Component, args: [{ selector: 'nz-form-item-feedback-icon', exportAs: 'nzFormFeedbackIcon', imports: [NzIconModule], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: ` @if (iconType) { <nz-icon [nzType]="iconType" /> } `, host: { class: 'ant-form-item-feedback-icon', '[class.ant-form-item-feedback-icon-error]': 'status==="error"', '[class.ant-form-item-feedback-icon-warning]': 'status==="warning"', '[class.ant-form-item-feedback-icon-success]': 'status==="success"', '[class.ant-form-item-feedback-icon-validating]': 'status==="validating"' } }] }], propDecorators: { status: [{ type: Input }] } }); /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ // Used in input-group/input-number-group to make sure components in addon work well /** * @deprecated Will be removed in v22.0.0. This service will be removed along with input-group/input-number-group. */ class NzFormNoStatusService { noFormStatus = new BehaviorSubject(false); static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NzFormNoStatusService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NzFormNoStatusService }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NzFormNoStatusService, decorators: [{ type: Injectable }] }); /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ const NZ_FORM_SIZE = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'nz-form-size' : ''); /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ class NzFormStatusService { formStatusChanges = new ReplaySubject(1); static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NzFormStatusService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NzFormStatusService }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NzFormStatusService, decorators: [{ type: Injectable }] }); /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ const NZ_FORM_VARIANT = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'nz-form-variant' : ''); /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ /** * Generated bundle index. Do not edit. */ export { NZ_FORM_SIZE, NZ_FORM_VARIANT, NzFormItemFeedbackIconComponent, NzFormNoStatusService, NzFormStatusService }; //# sourceMappingURL=ng-zorro-antd-core-form.mjs.map