@xmagic/nz-formly
Version:
基于ng-zorro-antd UI 扩展的ngx-formly组件库
208 lines (203 loc) • 9.95 kB
JavaScript
import * as i0 from '@angular/core';
import { Component, ChangeDetectionStrategy, Optional, ViewChild, NgModule } from '@angular/core';
import * as i5 from '@ngx-formly/core';
import { FieldWrapper, FormlyModule } from '@ngx-formly/core';
import * as i1 from '@xmagic/nz-formly/common';
import { resolveTplName } from '@xmagic/nz-formly/common';
import * as i2 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i3 from '@xmagic/nzx-antd/modal';
import { NzxModalModule } from '@xmagic/nzx-antd/modal';
import * as i4 from 'ng-zorro-antd/modal';
import { NzModalModule } from 'ng-zorro-antd/modal';
import { NzCardModule } from 'ng-zorro-antd/card';
class ModalWrapperComponent extends FieldWrapper {
fieldTemplates;
instance;
defaultOptions = {
props: {
nzOkType: 'primary',
nzCloseOnNavigation: true,
nzMaskClosable: false,
nzKeyboard: false,
nzClosable: true,
nzMask: true,
nzIconType: 'question-circle',
nzAutofocus: 'auto',
nzWidth: 520,
nzVisible: false,
nzCloseIcon: 'close',
nzOnCancel: (v, field, instance) => (field.props.nzVisible = false),
nzOnOk: (v, field, instance) => (field.props.nzVisible = false)
}
};
constructor(fieldTemplates) {
super();
this.fieldTemplates = fieldTemplates;
}
ngOnInit() {
this.props.instance = this.instance;
this.props.init?.(this.instance, this);
}
get nzTitle() {
return resolveTplName(this.props, this.fieldTemplates, 'nzTitle');
}
get nzFooter() {
return resolveTplName(this.props, this.fieldTemplates, 'nzFooter');
}
get nzCloseIcon() {
return resolveTplName(this.props, this.fieldTemplates, 'nzCloseIcon');
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ModalWrapperComponent, deps: [{ token: i1.FormlyBoxTemplates, optional: true }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ModalWrapperComponent, selector: "nz-formly-modal-wrapper", viewQueries: [{ propertyName: "instance", first: true, predicate: ["nzModal"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: `
<nz-modal
*ngIf="props.nzVisible"
nzxModalDrag
[]="true"
[]="props.label || nzTitle"
[]="field"
[]="props.nzAutofocus"
[]="props.nzBodyStyle"
[]="props.nzCancelDisabled"
[]="props.nzCancelLoading"
[]="props.nzCancelText"
[]="props.nzCentered"
[]="props.nzClassName"
[]="props.nzClosable"
[]="nzCloseIcon"
[]="props.nzCloseOnNavigation"
[]="props.nzComponentParams"
[]="nzFooter"
[]="props.nzIconType"
[]="props.nzKeyboard"
[]="props.nzMask"
[]="props.nzMaskClosable"
[]="props.nzMaskStyle"
[]="props.nzModalType"
[]="props.nzNoAnimation"
[]="props.nzOkDanger"
[]="props.nzOkDisabled"
[]="props.nzOkLoading"
[]="props.nzOkText"
[]="props.nzOkType"
[]="props.nzStyle"
[]="props.nzWidth"
[]="props.nzWrapClassName"
[]="props.nzZIndex"
(nzAfterClose)="props.onAfterClose && props.onAfterClose($event, field, instance)"
(nzAfterOpen)="props.nzAfterOpen && props.nzAfterOpen(field, instance)"
(nzOnCancel)="props.nzOnCancel?.($event, field, instance)"
(nzOnOk)="props.nzOnOk?.($event, field, instance)"
(nzVisibleChange)="props.nzVisibleChange?.($event, field, instance)"
>
<ng-container *nzModalContent>
<ng-container
</ng-container>
</nz-modal>
`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NzxModalDragDirective, selector: "nz-modal[nzxModalDrag]" }, { kind: "component", type: i4.NzModalComponent, selector: "nz-modal", inputs: ["nzMask", "nzMaskClosable", "nzCloseOnNavigation", "nzVisible", "nzClosable", "nzOkLoading", "nzOkDisabled", "nzCancelDisabled", "nzCancelLoading", "nzKeyboard", "nzNoAnimation", "nzCentered", "nzDraggable", "nzContent", "nzFooter", "nzZIndex", "nzWidth", "nzWrapClassName", "nzClassName", "nzStyle", "nzTitle", "nzCloseIcon", "nzMaskStyle", "nzBodyStyle", "nzOkText", "nzCancelText", "nzOkType", "nzOkDanger", "nzIconType", "nzModalType", "nzAutofocus", "nzOnOk", "nzOnCancel"], outputs: ["nzOnOk", "nzOnCancel", "nzAfterOpen", "nzAfterClose", "nzVisibleChange"], exportAs: ["nzModal"] }, { kind: "directive", type: i4.NzModalContentDirective, selector: "[nzModalContent]", exportAs: ["nzModalContent"] }, { kind: "directive", type: i5.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ModalWrapperComponent, decorators: [{
type: Component,
args: [{
selector: 'nz-formly-modal-wrapper',
template: `
<nz-modal
*ngIf="props.nzVisible"
nzxModalDrag
[]="true"
[]="props.label || nzTitle"
[]="field"
[]="props.nzAutofocus"
[]="props.nzBodyStyle"
[]="props.nzCancelDisabled"
[]="props.nzCancelLoading"
[]="props.nzCancelText"
[]="props.nzCentered"
[]="props.nzClassName"
[]="props.nzClosable"
[]="nzCloseIcon"
[]="props.nzCloseOnNavigation"
[]="props.nzComponentParams"
[]="nzFooter"
[]="props.nzIconType"
[]="props.nzKeyboard"
[]="props.nzMask"
[]="props.nzMaskClosable"
[]="props.nzMaskStyle"
[]="props.nzModalType"
[]="props.nzNoAnimation"
[]="props.nzOkDanger"
[]="props.nzOkDisabled"
[]="props.nzOkLoading"
[]="props.nzOkText"
[]="props.nzOkType"
[]="props.nzStyle"
[]="props.nzWidth"
[]="props.nzWrapClassName"
[]="props.nzZIndex"
(nzAfterClose)="props.onAfterClose && props.onAfterClose($event, field, instance)"
(nzAfterOpen)="props.nzAfterOpen && props.nzAfterOpen(field, instance)"
(nzOnCancel)="props.nzOnCancel?.($event, field, instance)"
(nzOnOk)="props.nzOnOk?.($event, field, instance)"
(nzVisibleChange)="props.nzVisibleChange?.($event, field, instance)"
>
<ng-container *nzModalContent>
<ng-container
</ng-container>
</nz-modal>
`,
changeDetection: ChangeDetectionStrategy.OnPush
}]
}], ctorParameters: () => [{ type: i1.FormlyBoxTemplates, decorators: [{
type: Optional
}] }], propDecorators: { instance: [{
type: ViewChild,
args: ['nzModal', { static: true }]
}] } });
const COMPONENT = ModalWrapperComponent;
class FormlyNzModalWrapperModule {
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FormlyNzModalWrapperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: FormlyNzModalWrapperModule, declarations: [ModalWrapperComponent], imports: [CommonModule,
NzCardModule,
NzxModalModule,
NzModalModule, i5.FormlyModule] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FormlyNzModalWrapperModule, imports: [CommonModule,
NzCardModule,
NzxModalModule,
NzModalModule,
FormlyModule.forChild({
wrappers: [
{
name: 'modal-wrapper',
component: COMPONENT
}
]
})] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FormlyNzModalWrapperModule, decorators: [{
type: NgModule,
args: [{
declarations: [COMPONENT],
imports: [
CommonModule,
NzCardModule,
NzxModalModule,
NzModalModule,
FormlyModule.forChild({
wrappers: [
{
name: 'modal-wrapper',
component: COMPONENT
}
]
})
]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { FormlyNzModalWrapperModule, ModalWrapperComponent };
//# sourceMappingURL=xmagic-nz-formly-modal-wrapper.mjs.map