ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
98 lines (90 loc) • 4.99 kB
JavaScript
import * as i0 from '@angular/core';
import { input, computed, ViewEncapsulation, Component, InjectionToken, Injectable } from '@angular/core';
import * as i1 from 'ng-zorro-antd/icon';
import { NzIconModule } from 'ng-zorro-antd/icon';
import { 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'
};
const CLASS_NAME = 'ant-form-item-feedback-icon';
class NzFormItemFeedbackIconComponent {
status = input('', /* @ts-ignore */
...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
iconType = computed(() => {
const status = this.status();
return status ? iconTypeMap[status] : null;
}, /* @ts-ignore */
...(ngDevMode ? [{ debugName: "iconType" }] : /* istanbul ignore next */ []));
class = computed(() => {
const status = this.status();
return {
[CLASS_NAME]: true,
[`${CLASS_NAME}-error`]: status === 'error',
[`${CLASS_NAME}-warning`]: status === 'warning',
[`${CLASS_NAME}-success`]: status === 'success',
[`${CLASS_NAME}-validating`]: status === 'validating'
};
}, /* @ts-ignore */
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NzFormItemFeedbackIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: NzFormItemFeedbackIconComponent, isStandalone: true, selector: "nz-form-item-feedback-icon", inputs: { status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "class()" } }, exportAs: ["nzFormFeedbackIcon"], ngImport: i0, template: `
@if (iconType(); as type) {
<nz-icon [nzType]="type" />
}
`, isInline: true, dependencies: [{ kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzType", "nzTheme", "nzTwotoneColor", "nzSpin", "nzRotate", "nzIconfont"], exportAs: ["nzIcon"] }], encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NzFormItemFeedbackIconComponent, decorators: [{
type: Component,
args: [{
selector: 'nz-form-item-feedback-icon',
exportAs: 'nzFormFeedbackIcon',
imports: [NzIconModule],
encapsulation: ViewEncapsulation.None,
template: `
@if (iconType(); as type) {
<nz-icon [nzType]="type" />
}
`,
host: {
'[class]': 'class()'
}
}]
}], propDecorators: { status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }] } });
/**
* 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: "22.0.6", ngImport: i0, type: NzFormStatusService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NzFormStatusService });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", 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, NzFormStatusService };
//# sourceMappingURL=ng-zorro-antd-core-form.mjs.map