ngx-formly-zorro-antd 16.1.3 → 16.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/cascader/cascader.module.d.ts +4 -3
- package/cascader/cascader.type.d.ts +14 -1
- package/common/formly-utils.d.ts +7 -0
- package/esm2022/cascader/cascader.module.mjs +5 -1
- package/esm2022/cascader/cascader.type.mjs +41 -21
- package/esm2022/common/formly-utils.mjs +11 -1
- package/esm2022/form-field/form-field.module.mjs +10 -2
- package/esm2022/form-field/form-field.props.mjs +1 -1
- package/esm2022/form-field/form-field.wrapper.mjs +109 -81
- package/fesm2022/ngx-formly-zorro-antd-cascader.mjs +44 -21
- package/fesm2022/ngx-formly-zorro-antd-cascader.mjs.map +1 -1
- package/fesm2022/ngx-formly-zorro-antd-common.mjs +11 -1
- package/fesm2022/ngx-formly-zorro-antd-common.mjs.map +1 -1
- package/fesm2022/ngx-formly-zorro-antd-form-field.mjs +116 -81
- package/fesm2022/ngx-formly-zorro-antd-form-field.mjs.map +1 -1
- package/form-field/form-field.module.d.ts +4 -2
- package/form-field/form-field.props.d.ts +7 -2
- package/form-field/form-field.wrapper.d.ts +10 -2
- package/package.json +26 -26
@@ -1,131 +1,159 @@
|
|
1
|
-
import { Component } from '@angular/core';
|
1
|
+
import { Component, Optional } from '@angular/core';
|
2
2
|
import { FieldWrapper } from '@ngx-formly/core';
|
3
|
+
import { resolveTplName, hasTplNameValue, FormlyBoxTemplates } from 'ngx-formly-zorro-antd/common';
|
3
4
|
import * as i0 from "@angular/core";
|
4
|
-
import * as i1 from "
|
5
|
-
import * as i2 from "
|
6
|
-
import * as i3 from "ng-zorro-antd/
|
7
|
-
import * as i4 from "
|
5
|
+
import * as i1 from "ngx-formly-zorro-antd/common";
|
6
|
+
import * as i2 from "@angular/common";
|
7
|
+
import * as i3 from "ng-zorro-antd/grid";
|
8
|
+
import * as i4 from "ng-zorro-antd/form";
|
9
|
+
import * as i5 from "ng-zorro-antd/core/outlet";
|
10
|
+
import * as i6 from "@ngx-formly/core";
|
8
11
|
export class FormlyWrapperFormField extends FieldWrapper {
|
9
|
-
|
10
|
-
|
12
|
+
constructor(fieldTemplates) {
|
13
|
+
super();
|
14
|
+
this.fieldTemplates = fieldTemplates;
|
11
15
|
}
|
12
|
-
|
16
|
+
get nzTooltipTitle() {
|
17
|
+
return resolveTplName(this.props, this.fieldTemplates, 'tooltipTitle');
|
18
|
+
}
|
19
|
+
get nzExtra() {
|
20
|
+
return resolveTplName(this.props, this.fieldTemplates, 'extra');
|
21
|
+
}
|
22
|
+
get hasLabel() {
|
23
|
+
return hasTplNameValue(this.props, 'label');
|
24
|
+
}
|
25
|
+
get label() {
|
26
|
+
return resolveTplName(this.props, this.fieldTemplates, 'label');
|
27
|
+
}
|
28
|
+
get hasError() {
|
29
|
+
return (this.formControl?.dirty || this.formControl?.touched) && this.formControl.errors;
|
30
|
+
}
|
31
|
+
get validateStatus() {
|
32
|
+
return this.hasError ? 'error' : 'success';
|
33
|
+
}
|
34
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: FormlyWrapperFormField, deps: [{ token: i1.FormlyBoxTemplates, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
13
35
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.5", type: FormlyWrapperFormField, selector: "formly-wrapper-nz-form-field", usesInheritance: true, ngImport: i0, template: `
|
14
36
|
<nz-form-item [ngClass]="props.itemClass!">
|
15
|
-
<ng-container *ngIf="
|
37
|
+
<ng-container *ngIf="hasLabel && props['hideLabel'] !== true">
|
16
38
|
<nz-form-label
|
17
|
-
[nzFlex]="props['grid']?.labelFlex
|
18
|
-
[nzOffset]="props['grid']?.labelOffset
|
19
|
-
[nzOrder]="props['grid']?.labelOrder
|
20
|
-
[nzPull]="props['grid']?.labelPull
|
21
|
-
[nzPush]="props['grid']?.labelPush
|
22
|
-
[nzSpan]="props['grid']?.labelSpan
|
23
|
-
[nzXs]="props['grid']?.labelXs
|
24
|
-
[nzSm]="props['grid']?.labelSm
|
25
|
-
[nzMd]="props['grid']?.labelMd
|
26
|
-
[nzLg]="props['grid']?.labelLg
|
27
|
-
[nzXl]="props['grid']?.labelXl
|
28
|
-
[nzXXl]="props['grid']?.labelXXl
|
29
|
-
[ngClass]="props.labelClass
|
39
|
+
[nzFlex]="props['grid']?.labelFlex || formState.labelFlex"
|
40
|
+
[nzOffset]="props['grid']?.labelOffset || formState.labelOffset"
|
41
|
+
[nzOrder]="props['grid']?.labelOrder || formState.labelOrder"
|
42
|
+
[nzPull]="props['grid']?.labelPull || formState.labelPull"
|
43
|
+
[nzPush]="props['grid']?.labelPush || formState.labelPush"
|
44
|
+
[nzSpan]="props['grid']?.labelSpan || formState.labelSpan"
|
45
|
+
[nzXs]="props['grid']?.labelXs || formState.labelXs"
|
46
|
+
[nzSm]="props['grid']?.labelSm || formState.labelSm"
|
47
|
+
[nzMd]="props['grid']?.labelMd || formState.labelMd"
|
48
|
+
[nzLg]="props['grid']?.labelLg || formState.labelLg"
|
49
|
+
[nzXl]="props['grid']?.labelXl || formState.labelXl"
|
50
|
+
[nzXXl]="props['grid']?.labelXXl || formState.labelXXl"
|
51
|
+
[ngClass]="props.labelClass || formState.labelClass"
|
30
52
|
[nzRequired]="props.required && props['hideRequiredMarker'] !== true"
|
31
53
|
[nzFor]="id"
|
32
54
|
[nzNoColon]="props['noColon']!!"
|
33
|
-
[nzTooltipTitle]="
|
55
|
+
[nzTooltipTitle]="nzTooltipTitle"
|
34
56
|
[nzTooltipIcon]="props['tooltipIcon']!"
|
35
57
|
[nzLabelAlign]="props['labelAlign'] ?? 'right'"
|
36
58
|
[nzLabelWrap]="props['labelWrap']!!"
|
37
59
|
>
|
38
|
-
<
|
39
|
-
{
|
40
|
-
|
60
|
+
<ng-container
|
61
|
+
*nzStringTemplateOutlet="label; context: { $implicit: field, options: props }"
|
62
|
+
>
|
63
|
+
<div class="formly-label-text" [attr.title]="label" [innerHTML]="label"></div>
|
64
|
+
</ng-container>
|
41
65
|
</nz-form-label>
|
42
66
|
</ng-container>
|
43
67
|
<nz-form-control
|
44
|
-
[nzValidateStatus]="
|
68
|
+
[nzValidateStatus]="validateStatus"
|
45
69
|
[nzHasFeedback]="props['hasFeedback']!!"
|
46
|
-
[nzExtra]="props
|
47
|
-
[nzErrorTip]="
|
70
|
+
[nzExtra]="props.description || nzExtra"
|
71
|
+
[nzErrorTip]="errorTip"
|
48
72
|
[ngClass]="props.controlClass!"
|
49
|
-
[nzFlex]="props['grid']?.controlFlex
|
50
|
-
[nzOffset]="props['grid']?.controlOffset
|
51
|
-
[nzOrder]="props['grid']?.controlOrder
|
52
|
-
[nzPull]="props['grid']?.controlPull
|
53
|
-
[nzPush]="props['grid']?.controlPush
|
54
|
-
[nzSpan]="props['grid']?.controlSpan
|
55
|
-
[nzXs]="props['grid']?.controlXs
|
56
|
-
[nzSm]="props['grid']?.controlSm
|
57
|
-
[nzMd]="props['grid']?.controlMd
|
58
|
-
[nzLg]="props['grid']?.controlLg
|
59
|
-
[nzXl]="props['grid']?.controlXl
|
60
|
-
[nzXXl]="props['grid']?.controlXXl
|
73
|
+
[nzFlex]="props['grid']?.controlFlex || formState.controlFlex"
|
74
|
+
[nzOffset]="props['grid']?.controlOffset || formState.controlOffset"
|
75
|
+
[nzOrder]="props['grid']?.controlOrder || formState.controlOrder"
|
76
|
+
[nzPull]="props['grid']?.controlPull || formState.controlPull"
|
77
|
+
[nzPush]="props['grid']?.controlPush || formState.controlPush"
|
78
|
+
[nzSpan]="props['grid']?.controlSpan || formState.controlSpan"
|
79
|
+
[nzXs]="props['grid']?.controlXs || formState.controlXs"
|
80
|
+
[nzSm]="props['grid']?.controlSm || formState.controlSm"
|
81
|
+
[nzMd]="props['grid']?.controlMd || formState.controlMd"
|
82
|
+
[nzLg]="props['grid']?.controlLg || formState.controlLg"
|
83
|
+
[nzXl]="props['grid']?.controlXl || formState.controlXl"
|
84
|
+
[nzXXl]="props['grid']?.controlXXl || formState.controlXXl"
|
61
85
|
>
|
62
86
|
<ng-container #fieldComponent></ng-container>
|
63
87
|
|
64
|
-
<ng-template #
|
65
|
-
<formly-validation-message [field]="field"></formly-validation-message>
|
88
|
+
<ng-template #errorTip let-control>
|
89
|
+
<formly-validation-message *ngIf="hasError" [field]="field"></formly-validation-message>
|
66
90
|
</ng-template>
|
67
91
|
</nz-form-control>
|
68
92
|
</nz-form-item>
|
69
|
-
`, isInline: true, styles: [":host .formly-label-text{overflow:hidden;text-overflow:ellipsis}\n"], dependencies: [{ kind: "directive", type:
|
93
|
+
`, isInline: true, styles: [":host .formly-label-text{overflow:hidden;text-overflow:ellipsis}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NzColDirective, selector: "[nz-col],nz-col,nz-form-control,nz-form-label", inputs: ["nzFlex", "nzSpan", "nzOrder", "nzOffset", "nzPush", "nzPull", "nzXs", "nzSm", "nzMd", "nzLg", "nzXl", "nzXXl"], exportAs: ["nzCol"] }, { kind: "directive", type: i3.NzRowDirective, selector: "[nz-row],nz-row,nz-form-item", inputs: ["nzAlign", "nzJustify", "nzGutter"], exportAs: ["nzRow"] }, { kind: "component", type: i4.NzFormItemComponent, selector: "nz-form-item", exportAs: ["nzFormItem"] }, { kind: "component", type: i4.NzFormLabelComponent, selector: "nz-form-label", inputs: ["nzFor", "nzRequired", "nzNoColon", "nzTooltipTitle", "nzTooltipIcon", "nzLabelAlign", "nzLabelWrap"], exportAs: ["nzFormLabel"] }, { kind: "component", type: i4.NzFormControlComponent, selector: "nz-form-control", inputs: ["nzSuccessTip", "nzWarningTip", "nzErrorTip", "nzValidatingTip", "nzExtra", "nzAutoTips", "nzDisableAutoTips", "nzHasFeedback", "nzValidateStatus"], exportAs: ["nzFormControl"] }, { kind: "directive", type: i5.NzStringTemplateOutletDirective, selector: "[nzStringTemplateOutlet]", inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"], exportAs: ["nzStringTemplateOutlet"] }, { kind: "component", type: i6.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }] }); }
|
70
94
|
}
|
71
95
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: FormlyWrapperFormField, decorators: [{
|
72
96
|
type: Component,
|
73
97
|
args: [{ selector: 'formly-wrapper-nz-form-field', template: `
|
74
98
|
<nz-form-item [ngClass]="props.itemClass!">
|
75
|
-
<ng-container *ngIf="
|
99
|
+
<ng-container *ngIf="hasLabel && props['hideLabel'] !== true">
|
76
100
|
<nz-form-label
|
77
|
-
[nzFlex]="props['grid']?.labelFlex
|
78
|
-
[nzOffset]="props['grid']?.labelOffset
|
79
|
-
[nzOrder]="props['grid']?.labelOrder
|
80
|
-
[nzPull]="props['grid']?.labelPull
|
81
|
-
[nzPush]="props['grid']?.labelPush
|
82
|
-
[nzSpan]="props['grid']?.labelSpan
|
83
|
-
[nzXs]="props['grid']?.labelXs
|
84
|
-
[nzSm]="props['grid']?.labelSm
|
85
|
-
[nzMd]="props['grid']?.labelMd
|
86
|
-
[nzLg]="props['grid']?.labelLg
|
87
|
-
[nzXl]="props['grid']?.labelXl
|
88
|
-
[nzXXl]="props['grid']?.labelXXl
|
89
|
-
[ngClass]="props.labelClass
|
101
|
+
[nzFlex]="props['grid']?.labelFlex || formState.labelFlex"
|
102
|
+
[nzOffset]="props['grid']?.labelOffset || formState.labelOffset"
|
103
|
+
[nzOrder]="props['grid']?.labelOrder || formState.labelOrder"
|
104
|
+
[nzPull]="props['grid']?.labelPull || formState.labelPull"
|
105
|
+
[nzPush]="props['grid']?.labelPush || formState.labelPush"
|
106
|
+
[nzSpan]="props['grid']?.labelSpan || formState.labelSpan"
|
107
|
+
[nzXs]="props['grid']?.labelXs || formState.labelXs"
|
108
|
+
[nzSm]="props['grid']?.labelSm || formState.labelSm"
|
109
|
+
[nzMd]="props['grid']?.labelMd || formState.labelMd"
|
110
|
+
[nzLg]="props['grid']?.labelLg || formState.labelLg"
|
111
|
+
[nzXl]="props['grid']?.labelXl || formState.labelXl"
|
112
|
+
[nzXXl]="props['grid']?.labelXXl || formState.labelXXl"
|
113
|
+
[ngClass]="props.labelClass || formState.labelClass"
|
90
114
|
[nzRequired]="props.required && props['hideRequiredMarker'] !== true"
|
91
115
|
[nzFor]="id"
|
92
116
|
[nzNoColon]="props['noColon']!!"
|
93
|
-
[nzTooltipTitle]="
|
117
|
+
[nzTooltipTitle]="nzTooltipTitle"
|
94
118
|
[nzTooltipIcon]="props['tooltipIcon']!"
|
95
119
|
[nzLabelAlign]="props['labelAlign'] ?? 'right'"
|
96
120
|
[nzLabelWrap]="props['labelWrap']!!"
|
97
121
|
>
|
98
|
-
<
|
99
|
-
{
|
100
|
-
|
122
|
+
<ng-container
|
123
|
+
*nzStringTemplateOutlet="label; context: { $implicit: field, options: props }"
|
124
|
+
>
|
125
|
+
<div class="formly-label-text" [attr.title]="label" [innerHTML]="label"></div>
|
126
|
+
</ng-container>
|
101
127
|
</nz-form-label>
|
102
128
|
</ng-container>
|
103
129
|
<nz-form-control
|
104
|
-
[nzValidateStatus]="
|
130
|
+
[nzValidateStatus]="validateStatus"
|
105
131
|
[nzHasFeedback]="props['hasFeedback']!!"
|
106
|
-
[nzExtra]="props
|
107
|
-
[nzErrorTip]="
|
132
|
+
[nzExtra]="props.description || nzExtra"
|
133
|
+
[nzErrorTip]="errorTip"
|
108
134
|
[ngClass]="props.controlClass!"
|
109
|
-
[nzFlex]="props['grid']?.controlFlex
|
110
|
-
[nzOffset]="props['grid']?.controlOffset
|
111
|
-
[nzOrder]="props['grid']?.controlOrder
|
112
|
-
[nzPull]="props['grid']?.controlPull
|
113
|
-
[nzPush]="props['grid']?.controlPush
|
114
|
-
[nzSpan]="props['grid']?.controlSpan
|
115
|
-
[nzXs]="props['grid']?.controlXs
|
116
|
-
[nzSm]="props['grid']?.controlSm
|
117
|
-
[nzMd]="props['grid']?.controlMd
|
118
|
-
[nzLg]="props['grid']?.controlLg
|
119
|
-
[nzXl]="props['grid']?.controlXl
|
120
|
-
[nzXXl]="props['grid']?.controlXXl
|
135
|
+
[nzFlex]="props['grid']?.controlFlex || formState.controlFlex"
|
136
|
+
[nzOffset]="props['grid']?.controlOffset || formState.controlOffset"
|
137
|
+
[nzOrder]="props['grid']?.controlOrder || formState.controlOrder"
|
138
|
+
[nzPull]="props['grid']?.controlPull || formState.controlPull"
|
139
|
+
[nzPush]="props['grid']?.controlPush || formState.controlPush"
|
140
|
+
[nzSpan]="props['grid']?.controlSpan || formState.controlSpan"
|
141
|
+
[nzXs]="props['grid']?.controlXs || formState.controlXs"
|
142
|
+
[nzSm]="props['grid']?.controlSm || formState.controlSm"
|
143
|
+
[nzMd]="props['grid']?.controlMd || formState.controlMd"
|
144
|
+
[nzLg]="props['grid']?.controlLg || formState.controlLg"
|
145
|
+
[nzXl]="props['grid']?.controlXl || formState.controlXl"
|
146
|
+
[nzXXl]="props['grid']?.controlXXl || formState.controlXXl"
|
121
147
|
>
|
122
148
|
<ng-container #fieldComponent></ng-container>
|
123
149
|
|
124
|
-
<ng-template #
|
125
|
-
<formly-validation-message [field]="field"></formly-validation-message>
|
150
|
+
<ng-template #errorTip let-control>
|
151
|
+
<formly-validation-message *ngIf="hasError" [field]="field"></formly-validation-message>
|
126
152
|
</ng-template>
|
127
153
|
</nz-form-control>
|
128
154
|
</nz-form-item>
|
129
155
|
`, styles: [":host .formly-label-text{overflow:hidden;text-overflow:ellipsis}\n"] }]
|
130
|
-
}]
|
131
|
-
|
156
|
+
}], ctorParameters: function () { return [{ type: i1.FormlyBoxTemplates, decorators: [{
|
157
|
+
type: Optional
|
158
|
+
}] }]; } });
|
159
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybS1maWVsZC53cmFwcGVyLmpzIiwic291cmNl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gICAgICAgIDxuZy1jb250YWluZXJcbiAgICAgICAgICAgICpuelN0cmluZ1RlbXBsYXRlT3V0bGV0PVwibGFiZWw7IGNvbnRleHQ6IHsgJGltcGxpY2l0OiBmaWVsZCwgb3B0aW9uczogcHJvcHMgfVwiXG4gICAgICAgICAgPlxuICAgICAgICAgICAgPGRpdiBjbGFzcz1cImZvcm1seS1sYWJlbC10ZXh0XCIgW2F0dHIudGl0bGVdPVwibGFiZWxcIiBbaW5uZXJIVE1MXT1cImxhYmVsXCI+PC9kaXY+XG4gICAgICAgICAgPC9uZy1jb250YWluZXI+XG4gICAgICAgIDwvbnotZm9ybS1sYWJlbD5cbiAgICAgIDwvbmctY29udGFpbmVyPlxuICAgICAgPG56LWZvcm0tY29udHJvbFxuICAgICAgICBbbnpWYWxpZGF0ZVN0YXR1c109XCJ2YWxpZGF0ZVN0YXR1c1wiXG4gICAgICAgIFtuekhhc0ZlZWRiYWNrXT1cInByb3BzWydoYXNGZWVkYmFjayddISFcIlxuICAgICAgICBbbnpFeHRyYV09XCJwcm9wcy5kZXNjcmlwdGlvbiB8fCBuekV4dHJhXCJcbiAgICAgICAgW256RXJyb3JUaXBdPVwiZXJyb3JUaXBcIlxuICAgICAgICBbbmdDbGFzc109XCJwcm9wcy5jb250cm9sQ2xhc3MhXCJcbiAgICAgICAgW256RmxleF09XCJwcm9wc1snZ3JpZCddPy5jb250cm9sRmxleCB8fCBmb3JtU3RhdGUuY29udHJvbEZsZXhcIlxuICAgICAgICBbbnpPZmZzZXRdPVwicHJvcHNbJ2dyaWQnXT8uY29udHJvbE9mZnNldCB8fCBmb3JtU3RhdGUuY29udHJvbE9mZnNldFwiXG4gICAgICAgIFtuek9yZGVyXT1cInByb3BzWydncmlkJ10/LmNvbnRyb2xPcmRlciB8fCBmb3JtU3RhdGUuY29udHJvbE9yZGVyXCJcbiAgICAgICAgW256UHVsbF09XCJwcm9wc1snZ3JpZCddPy5jb250cm9sUHVsbCB8fCBmb3JtU3RhdGUuY29ud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
@@ -1,18 +1,21 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
3
|
-
import * as
|
2
|
+
import { Component, ChangeDetectionStrategy, Optional, NgModule } from '@angular/core';
|
3
|
+
import * as i2 from '@angular/common';
|
4
4
|
import { CommonModule } from '@angular/common';
|
5
|
-
import * as
|
5
|
+
import * as i5 from '@ngx-formly/core';
|
6
6
|
import { FieldType, FormlyModule } from '@ngx-formly/core';
|
7
|
-
import * as
|
7
|
+
import * as i3 from '@angular/forms';
|
8
8
|
import { ReactiveFormsModule } from '@angular/forms';
|
9
9
|
import { FormlyNzFormFieldModule } from 'ngx-formly-zorro-antd/form-field';
|
10
|
-
import * as
|
10
|
+
import * as i1 from 'ngx-formly-zorro-antd/common';
|
11
|
+
import { resolveTplName, FormlyCommonModule } from 'ngx-formly-zorro-antd/common';
|
12
|
+
import * as i4 from 'ng-zorro-antd/cascader';
|
11
13
|
import { NzCascaderModule } from 'ng-zorro-antd/cascader';
|
12
14
|
|
13
15
|
class FormlyFieldCascader extends FieldType {
|
14
|
-
constructor() {
|
15
|
-
super(
|
16
|
+
constructor(fieldTemplates) {
|
17
|
+
super();
|
18
|
+
this.fieldTemplates = fieldTemplates;
|
16
19
|
this.defaultOptions = {
|
17
20
|
props: {
|
18
21
|
placeholder: '请选择',
|
@@ -31,13 +34,28 @@ class FormlyFieldCascader extends FieldType {
|
|
31
34
|
}
|
32
35
|
};
|
33
36
|
}
|
37
|
+
get nzNotFoundContent() {
|
38
|
+
return resolveTplName(this.props, this.fieldTemplates, 'notFoundContent');
|
39
|
+
}
|
40
|
+
get nzExpandIcon() {
|
41
|
+
return resolveTplName(this.props, this.fieldTemplates, 'expandIcon');
|
42
|
+
}
|
43
|
+
get nzLabelRender() {
|
44
|
+
return resolveTplName(this.props, this.fieldTemplates, 'labelRender');
|
45
|
+
}
|
46
|
+
get nzOptionRender() {
|
47
|
+
return resolveTplName(this.props, this.fieldTemplates, 'optionRender');
|
48
|
+
}
|
49
|
+
get nzSuffixIcon() {
|
50
|
+
return resolveTplName(this.props, this.fieldTemplates, 'suffixIcon');
|
51
|
+
}
|
34
52
|
ngOnInit() {
|
35
53
|
const options = this.props['cascaderOptions'];
|
36
54
|
if (!options || options.length === 0) {
|
37
55
|
this.props['cascaderOptions'] = this.props.options;
|
38
56
|
}
|
39
57
|
}
|
40
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: FormlyFieldCascader, deps:
|
58
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: FormlyFieldCascader, deps: [{ token: i1.FormlyBoxTemplates, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
41
59
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.5", type: FormlyFieldCascader, selector: "formly-field-cascader", usesInheritance: true, ngImport: i0, template: `<nz-cascader
|
42
60
|
#cascader
|
43
61
|
[nzPlaceHolder]="props.placeholder ?? ''"
|
@@ -50,27 +68,27 @@ class FormlyFieldCascader extends FieldType {
|
|
50
68
|
[nzChangeOn]="props['changeOn']"
|
51
69
|
[nzChangeOnSelect]="props['changeOnSelect']!!"
|
52
70
|
[nzColumnClassName]="props['columnClassName']"
|
53
|
-
[nzExpandIcon]="
|
71
|
+
[nzExpandIcon]="nzExpandIcon!"
|
54
72
|
[nzExpandTrigger]="props['expandTrigger']!"
|
55
73
|
[nzLabelProperty]="props['labelProperty']"
|
56
|
-
[nzLabelRender]="
|
74
|
+
[nzLabelRender]="nzLabelRender ?? null"
|
57
75
|
[nzLoadData]="props['loadData']"
|
58
76
|
[nzMenuClassName]="props['menuClassName']"
|
59
77
|
[nzMenuStyle]="props['menuStyle'] ?? null"
|
60
|
-
[nzNotFoundContent]="
|
61
|
-
[nzOptionRender]="
|
78
|
+
[nzNotFoundContent]="nzNotFoundContent"
|
79
|
+
[nzOptionRender]="nzOptionRender ?? null"
|
62
80
|
[nzOptions]="props['cascaderOptions'] ?? null"
|
63
81
|
[nzShowArrow]="props['showArrow']!!"
|
64
82
|
[nzShowInput]="props['showInput']!!"
|
65
83
|
[nzShowSearch]="props['showSearch']!!"
|
66
84
|
[nzSize]="props['size']!"
|
67
85
|
[nzStatus]="props['status'] ?? ''"
|
68
|
-
[nzSuffixIcon]="
|
86
|
+
[nzSuffixIcon]="nzSuffixIcon!"
|
69
87
|
[nzValueProperty]="props['valueProperty']!"
|
70
88
|
(nzClear)="props['onClear'] && props['onClear'](field)"
|
71
89
|
(nzVisibleChange)="props['visibleChange'] && props['visibleChange'](field, $event)"
|
72
90
|
(nzSelectionChange)="props['selectionChange'] && props['selectionChange'](field, $event)"
|
73
|
-
></nz-cascader>`, isInline: true, dependencies: [{ kind: "directive", type:
|
91
|
+
></nz-cascader>`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i4.NzCascaderComponent, selector: "nz-cascader, [nz-cascader]", inputs: ["nzOptionRender", "nzShowInput", "nzShowArrow", "nzAllowClear", "nzAutoFocus", "nzChangeOnSelect", "nzDisabled", "nzColumnClassName", "nzExpandTrigger", "nzValueProperty", "nzLabelRender", "nzLabelProperty", "nzNotFoundContent", "nzSize", "nzBackdrop", "nzShowSearch", "nzPlaceHolder", "nzMenuClassName", "nzMenuStyle", "nzMouseEnterDelay", "nzMouseLeaveDelay", "nzStatus", "nzTriggerAction", "nzChangeOn", "nzLoadData", "nzSuffixIcon", "nzExpandIcon", "nzOptions"], outputs: ["nzVisibleChange", "nzSelectionChange", "nzSelect", "nzClear"], exportAs: ["nzCascader"] }, { kind: "directive", type: i5.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
74
92
|
}
|
75
93
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: FormlyFieldCascader, decorators: [{
|
76
94
|
type: Component,
|
@@ -88,22 +106,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImpor
|
|
88
106
|
[nzChangeOn]="props['changeOn']"
|
89
107
|
[nzChangeOnSelect]="props['changeOnSelect']!!"
|
90
108
|
[nzColumnClassName]="props['columnClassName']"
|
91
|
-
[nzExpandIcon]="
|
109
|
+
[nzExpandIcon]="nzExpandIcon!"
|
92
110
|
[nzExpandTrigger]="props['expandTrigger']!"
|
93
111
|
[nzLabelProperty]="props['labelProperty']"
|
94
|
-
[nzLabelRender]="
|
112
|
+
[nzLabelRender]="nzLabelRender ?? null"
|
95
113
|
[nzLoadData]="props['loadData']"
|
96
114
|
[nzMenuClassName]="props['menuClassName']"
|
97
115
|
[nzMenuStyle]="props['menuStyle'] ?? null"
|
98
|
-
[nzNotFoundContent]="
|
99
|
-
[nzOptionRender]="
|
116
|
+
[nzNotFoundContent]="nzNotFoundContent"
|
117
|
+
[nzOptionRender]="nzOptionRender ?? null"
|
100
118
|
[nzOptions]="props['cascaderOptions'] ?? null"
|
101
119
|
[nzShowArrow]="props['showArrow']!!"
|
102
120
|
[nzShowInput]="props['showInput']!!"
|
103
121
|
[nzShowSearch]="props['showSearch']!!"
|
104
122
|
[nzSize]="props['size']!"
|
105
123
|
[nzStatus]="props['status'] ?? ''"
|
106
|
-
[nzSuffixIcon]="
|
124
|
+
[nzSuffixIcon]="nzSuffixIcon!"
|
107
125
|
[nzValueProperty]="props['valueProperty']!"
|
108
126
|
(nzClear)="props['onClear'] && props['onClear'](field)"
|
109
127
|
(nzVisibleChange)="props['visibleChange'] && props['visibleChange'](field, $event)"
|
@@ -111,17 +129,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImpor
|
|
111
129
|
></nz-cascader>`,
|
112
130
|
changeDetection: ChangeDetectionStrategy.OnPush
|
113
131
|
}]
|
114
|
-
}]
|
132
|
+
}], ctorParameters: function () { return [{ type: i1.FormlyBoxTemplates, decorators: [{
|
133
|
+
type: Optional
|
134
|
+
}] }]; } });
|
115
135
|
|
116
136
|
class FormlyNzCascaderModule {
|
117
137
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: FormlyNzCascaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
118
138
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.5", ngImport: i0, type: FormlyNzCascaderModule, declarations: [FormlyFieldCascader], imports: [CommonModule,
|
119
139
|
ReactiveFormsModule,
|
120
140
|
FormlyNzFormFieldModule,
|
121
|
-
|
141
|
+
FormlyCommonModule,
|
142
|
+
NzCascaderModule, i5.FormlyModule] }); }
|
122
143
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: FormlyNzCascaderModule, imports: [CommonModule,
|
123
144
|
ReactiveFormsModule,
|
124
145
|
FormlyNzFormFieldModule,
|
146
|
+
FormlyCommonModule,
|
125
147
|
NzCascaderModule,
|
126
148
|
FormlyModule.forChild({
|
127
149
|
types: [
|
@@ -141,6 +163,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImpor
|
|
141
163
|
CommonModule,
|
142
164
|
ReactiveFormsModule,
|
143
165
|
FormlyNzFormFieldModule,
|
166
|
+
FormlyCommonModule,
|
144
167
|
NzCascaderModule,
|
145
168
|
FormlyModule.forChild({
|
146
169
|
types: [
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ngx-formly-zorro-antd-cascader.mjs","sources":["../../../../packages/formlyantd/cascader/src/cascader.type.ts","../../../../packages/formlyantd/cascader/src/cascader.module.ts","../../../../packages/formlyantd/cascader/src/ngx-formly-zorro-antd-cascader.ts"],"sourcesContent":["import { Component, TemplateRef, Type, ChangeDetectionStrategy, OnInit } from '@angular/core';\nimport { FieldType, FieldTypeConfig } from '@ngx-formly/core';\nimport { FormlyFieldProps } from 'ngx-formly-zorro-antd/form-field';\n\nimport type {\n NzCascaderOption,\n NzShowSearchOptions,\n NzCascaderExpandTrigger,\n NzCascaderSize\n} from 'ng-zorro-antd/cascader';\nimport type { NzSafeAny, NzStatus, NgStyleInterface } from 'ng-zorro-antd/core/types';\nimport type { NzFormlyFieldConfig, FormlyAttributeEvent } from 'ngx-formly-zorro-antd/common';\n\ninterface CascaderProps extends FormlyFieldProps {\n /**\n * 是否支持清除\n * @default true\n */\n allowClear?: boolean;\n\n /**\n * 是否自动聚焦,当存在输入框时\n * @default false\n */\n autoFocus?: boolean;\n\n /**\n * 浮层是否应带有背景板\n * @default false\n */\n backdrop?: boolean;\n\n /**\n * 点击父级菜单选项时,可通过该函数判断是否允许值的变化\n */\n changeOn?: (option: NzSafeAny, index: number) => boolean;\n\n /**\n * 当此项为 true 时,点选每级菜单选项值都会发生变化,具体见上面的演示\n * @default false\n */\n changeOnSelect?: boolean;\n\n /**\n * 自定义浮层列类名\n */\n columnClassName?: string;\n\n /**\n * 自定义次级菜单展开图标\n */\n expandIcon?: string | TemplateRef<void>;\n\n /**\n * 次级菜单的展开方式\n * @default 'click'\n */\n expandTrigger?: NzCascaderExpandTrigger;\n\n /**\n * 选项的显示值的属性名\n * @default 'label'\n */\n labelProperty: string;\n\n /**\n * 选择后展示的渲染模板\n */\n labelRender?: TemplateRef<NzSafeAny> | null;\n\n /**\n * 用于动态加载选项。如果提供了ngModel初始值,且未提供nzOptions值,则会立即触发动态加载。\n */\n loadData?: (option: NzSafeAny, index?: number) => PromiseLike<NzSafeAny>;\n\n /**\n * 自定义浮层类名\n */\n menuClassName?: string;\n\n /**\n * 自定义浮层样式\n */\n menuStyle?: NgStyleInterface | null;\n\n /**\n * 当下拉列表为空时显示的内容\n */\n notFoundContent?: string | TemplateRef<void>;\n\n /**\n * 选项的渲染模板\n */\n optionRender?: TemplateRef<{ $implicit: NzCascaderOption; index: number }> | null;\n\n /**\n * 是否显示箭头\n * @default true\n */\n showArrow?: boolean;\n\n /**\n * 显示输入框\n * @default true\n */\n showInput?: boolean;\n\n /**\n * 是否支持搜索,默认情况下对 label 进行全匹配搜索,不能和 [nzLoadData] 同时使用\n * @default false\n */\n showSearch?: boolean | NzShowSearchOptions;\n\n /**\n * 输入框大小\n * @default default\n */\n size?: NzCascaderSize;\n\n /**\n * 设置校验状态\n */\n status?: NzStatus;\n\n /**\n * 自定义的选择框后缀图标\n */\n suffixIcon?: string | TemplateRef<void>;\n\n /**\n * 选项的实际值的属性名\n * @default 'value'\n */\n valueProperty?: string;\n\n /**\n * 可选项数据源\n */\n cascaderOptions?: NzCascaderOption[] | null;\n\n /**\n * 清除值时触发\n */\n onClear?: FormlyAttributeEvent;\n /**\n * 菜单浮层的显示/隐藏\n */\n visibleChange?: FormlyAttributeEvent<boolean>;\n\n /**\n * 值发生变化时触发\n */\n selectionChange?: FormlyAttributeEvent<NzCascaderOption[]>;\n}\n\nexport interface FormlyCascaderFieldConfig extends NzFormlyFieldConfig<CascaderProps> {\n type: 'cascader' | Type<FormlyFieldCascader>;\n}\n\n@Component({\n selector: 'formly-field-cascader',\n template: `<nz-cascader\n #cascader\n [nzPlaceHolder]=\"props.placeholder ?? ''\"\n [formControl]=\"formControl\"\n [formlyAttributes]=\"field\"\n [ngClass]=\"props['className']!\"\n [nzAllowClear]=\"props['allowClear']!!\"\n [nzAutoFocus]=\"props['autoFocus']!!\"\n [nzBackdrop]=\"props['backdrop']!!\"\n [nzChangeOn]=\"props['changeOn']\"\n [nzChangeOnSelect]=\"props['changeOnSelect']!!\"\n [nzColumnClassName]=\"props['columnClassName']\"\n [nzExpandIcon]=\"props['expandIcon']!\"\n [nzExpandTrigger]=\"props['expandTrigger']!\"\n [nzLabelProperty]=\"props['labelProperty']\"\n [nzLabelRender]=\"props['labelRender'] ?? null\"\n [nzLoadData]=\"props['loadData']\"\n [nzMenuClassName]=\"props['menuClassName']\"\n [nzMenuStyle]=\"props['menuStyle'] ?? null\"\n [nzNotFoundContent]=\"props['notFoundContent']\"\n [nzOptionRender]=\"props['optionRender'] ?? null\"\n [nzOptions]=\"props['cascaderOptions'] ?? null\"\n [nzShowArrow]=\"props['showArrow']!!\"\n [nzShowInput]=\"props['showInput']!!\"\n [nzShowSearch]=\"props['showSearch']!!\"\n [nzSize]=\"props['size']!\"\n [nzStatus]=\"props['status'] ?? ''\"\n [nzSuffixIcon]=\"props['suffixIcon']!\"\n [nzValueProperty]=\"props['valueProperty']!\"\n (nzClear)=\"props['onClear'] && props['onClear'](field)\"\n (nzVisibleChange)=\"props['visibleChange'] && props['visibleChange'](field, $event)\"\n (nzSelectionChange)=\"props['selectionChange'] && props['selectionChange'](field, $event)\"\n ></nz-cascader>`,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class FormlyFieldCascader\n extends FieldType<FieldTypeConfig<CascaderProps>>\n implements OnInit\n{\n override defaultOptions = {\n props: {\n placeholder: '请选择',\n allowClear: true,\n backdrop: false,\n changeOnSelect: false,\n expandTrigger: 'click' as const,\n labelProperty: 'label',\n showArrow: true,\n showInput: true,\n showSearch: false,\n size: 'default' as const,\n status: '' as const,\n valueProperty: 'value',\n cascaderOptions: []\n }\n };\n\n ngOnInit(): void {\n const options = this.props['cascaderOptions'];\n if (!options || options.length === 0) {\n this.props['cascaderOptions'] = this.props.options as NzSafeAny;\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { FormlyNzFormFieldModule } from 'ngx-formly-zorro-antd/form-field';\n\nimport { NzCascaderModule } from 'ng-zorro-antd/cascader';\nimport { FormlyFieldCascader } from './cascader.type';\n\n@NgModule({\n declarations: [FormlyFieldCascader],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n FormlyNzFormFieldModule,\n\n NzCascaderModule,\n\n FormlyModule.forChild({\n types: [\n {\n name: 'cascader',\n component: FormlyFieldCascader,\n wrappers: ['form-field']\n }\n ]\n })\n ]\n})\nexport class FormlyNzCascaderModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;AAoMM,MAAO,mBACX,SAAQ,SAAyC,CAAA;AAtCnD,IAAA,WAAA,GAAA;;AAyCW,QAAA,IAAA,CAAA,cAAc,GAAG;AACxB,YAAA,KAAK,EAAE;AACL,gBAAA,WAAW,EAAE,KAAK;AAClB,gBAAA,UAAU,EAAE,IAAI;AAChB,gBAAA,QAAQ,EAAE,KAAK;AACf,gBAAA,cAAc,EAAE,KAAK;AACrB,gBAAA,aAAa,EAAE,OAAgB;AAC/B,gBAAA,aAAa,EAAE,OAAO;AACtB,gBAAA,SAAS,EAAE,IAAI;AACf,gBAAA,SAAS,EAAE,IAAI;AACf,gBAAA,UAAU,EAAE,KAAK;AACjB,gBAAA,IAAI,EAAE,SAAkB;AACxB,gBAAA,MAAM,EAAE,EAAW;AACnB,gBAAA,aAAa,EAAE,OAAO;AACtB,gBAAA,eAAe,EAAE,EAAE;AACpB,aAAA;SACF,CAAC;AAQH,KAAA;IANC,QAAQ,GAAA;QACN,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACpC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAoB,CAAC;AACjE,SAAA;KACF;8GA3BU,mBAAmB,EAAA,IAAA,EAAA,IAAA,EAA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AAY;YACZ,mBAAmB;YACnB,uBAAuB;YAEvB,gBAAgB;YAEhB,YAAY,CAAC,QAAQ,CAAC;AACpB,gBAAA,KAAK,EAAE;AACL,oBAAA;AACE,wBAAA,IAAI,EAAE,UAAU;AAChB,wBAAA,SAAS,EAAE,mBAAmB;wBAC9B,QAAQ,EAAE,CAAC,YAAY,CAAC;AACzB,qBAAA;AACF,iBAAA;aACF,CAAC,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAGO,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBApBlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,mBAAmB,CAAC;AACnC,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBACnB,uBAAuB;wBAEvB,gBAAgB;wBAEhB,YAAY,CAAC,QAAQ,CAAC;AACpB,4BAAA,KAAK,EAAE;AACL,gCAAA;AACE,oCAAA,IAAI,EAAE,UAAU;AAChB,oCAAA,SAAS,EAAE,mBAAmB;oCAC9B,QAAQ,EAAE,CAAC,YAAY,CAAC;AACzB,iCAAA;AACF,6BAAA;yBACF,CAAC;AACH,qBAAA;AACF,iBAAA,CAAA;;;AC5BD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"ngx-formly-zorro-antd-cascader.mjs","sources":["../../../../packages/formlyantd/cascader/src/cascader.type.ts","../../../../packages/formlyantd/cascader/src/cascader.module.ts","../../../../packages/formlyantd/cascader/src/ngx-formly-zorro-antd-cascader.ts"],"sourcesContent":["import {\n Component,\n TemplateRef,\n Optional,\n Type,\n ChangeDetectionStrategy,\n OnInit\n} from '@angular/core';\nimport { FieldType, FieldTypeConfig } from '@ngx-formly/core';\nimport { FormlyFieldProps } from 'ngx-formly-zorro-antd/form-field';\n\nimport type {\n NzCascaderOption,\n NzShowSearchOptions,\n NzCascaderExpandTrigger,\n NzCascaderSize\n} from 'ng-zorro-antd/cascader';\nimport type { NzSafeAny, NzStatus, NgStyleInterface } from 'ng-zorro-antd/core/types';\nimport type { NzFormlyFieldConfig, FormlyAttributeEvent } from 'ngx-formly-zorro-antd/common';\nimport { resolveTplName, FormlyBoxTemplates } from 'ngx-formly-zorro-antd/common';\n\ninterface CascaderProps extends FormlyFieldProps {\n /**\n * 是否支持清除\n * @default true\n */\n allowClear?: boolean;\n\n /**\n * 是否自动聚焦,当存在输入框时\n * @default false\n */\n autoFocus?: boolean;\n\n /**\n * 浮层是否应带有背景板\n * @default false\n */\n backdrop?: boolean;\n\n /**\n * 点击父级菜单选项时,可通过该函数判断是否允许值的变化\n */\n changeOn?: (option: NzSafeAny, index: number) => boolean;\n\n /**\n * 当此项为 true 时,点选每级菜单选项值都会发生变化,具体见上面的演示\n * @default false\n */\n changeOnSelect?: boolean;\n\n /**\n * 自定义浮层列类名\n */\n columnClassName?: string;\n\n /**\n * 自定义次级菜单展开图标\n */\n expandIcon?: string | TemplateRef<void>;\n expandIconName?: string;\n\n /**\n * 次级菜单的展开方式\n * @default 'click'\n */\n expandTrigger?: NzCascaderExpandTrigger;\n\n /**\n * 选项的显示值的属性名\n * @default 'label'\n */\n labelProperty: string;\n\n /**\n * 选择后展示的渲染模板\n */\n labelRender?: TemplateRef<NzSafeAny> | null;\n labelRenderName?: string;\n\n /**\n * 用于动态加载选项。如果提供了ngModel初始值,且未提供nzOptions值,则会立即触发动态加载。\n */\n loadData?: (option: NzSafeAny, index?: number) => PromiseLike<NzSafeAny>;\n\n /**\n * 自定义浮层类名\n */\n menuClassName?: string;\n\n /**\n * 自定义浮层样式\n */\n menuStyle?: NgStyleInterface | null;\n\n /**\n * 当下拉列表为空时显示的内容\n */\n notFoundContent?: string | TemplateRef<void>;\n notFoundContentName?: string;\n\n /**\n * 选项的渲染模板\n */\n optionRender?: TemplateRef<{ $implicit: NzCascaderOption; index: number }> | null;\n optionRenderName?: string;\n\n /**\n * 是否显示箭头\n * @default true\n */\n showArrow?: boolean;\n\n /**\n * 显示输入框\n * @default true\n */\n showInput?: boolean;\n\n /**\n * 是否支持搜索,默认情况下对 label 进行全匹配搜索,不能和 [nzLoadData] 同时使用\n * @default false\n */\n showSearch?: boolean | NzShowSearchOptions;\n\n /**\n * 输入框大小\n * @default default\n */\n size?: NzCascaderSize;\n\n /**\n * 设置校验状态\n */\n status?: NzStatus;\n\n /**\n * 自定义的选择框后缀图标\n */\n suffixIcon?: string | TemplateRef<void>;\n suffixIconName?: string;\n\n /**\n * 选项的实际值的属性名\n * @default 'value'\n */\n valueProperty?: string;\n\n /**\n * 可选项数据源\n */\n cascaderOptions?: NzCascaderOption[] | null;\n\n /**\n * 清除值时触发\n */\n onClear?: FormlyAttributeEvent;\n /**\n * 菜单浮层的显示/隐藏\n */\n visibleChange?: FormlyAttributeEvent<boolean>;\n\n /**\n * 值发生变化时触发\n */\n selectionChange?: FormlyAttributeEvent<NzCascaderOption[]>;\n}\n\nexport interface FormlyCascaderFieldConfig extends NzFormlyFieldConfig<CascaderProps> {\n type: 'cascader' | Type<FormlyFieldCascader>;\n}\n\n@Component({\n selector: 'formly-field-cascader',\n template: `<nz-cascader\n #cascader\n [nzPlaceHolder]=\"props.placeholder ?? ''\"\n [formControl]=\"formControl\"\n [formlyAttributes]=\"field\"\n [ngClass]=\"props['className']!\"\n [nzAllowClear]=\"props['allowClear']!!\"\n [nzAutoFocus]=\"props['autoFocus']!!\"\n [nzBackdrop]=\"props['backdrop']!!\"\n [nzChangeOn]=\"props['changeOn']\"\n [nzChangeOnSelect]=\"props['changeOnSelect']!!\"\n [nzColumnClassName]=\"props['columnClassName']\"\n [nzExpandIcon]=\"nzExpandIcon!\"\n [nzExpandTrigger]=\"props['expandTrigger']!\"\n [nzLabelProperty]=\"props['labelProperty']\"\n [nzLabelRender]=\"nzLabelRender ?? null\"\n [nzLoadData]=\"props['loadData']\"\n [nzMenuClassName]=\"props['menuClassName']\"\n [nzMenuStyle]=\"props['menuStyle'] ?? null\"\n [nzNotFoundContent]=\"nzNotFoundContent\"\n [nzOptionRender]=\"nzOptionRender ?? null\"\n [nzOptions]=\"props['cascaderOptions'] ?? null\"\n [nzShowArrow]=\"props['showArrow']!!\"\n [nzShowInput]=\"props['showInput']!!\"\n [nzShowSearch]=\"props['showSearch']!!\"\n [nzSize]=\"props['size']!\"\n [nzStatus]=\"props['status'] ?? ''\"\n [nzSuffixIcon]=\"nzSuffixIcon!\"\n [nzValueProperty]=\"props['valueProperty']!\"\n (nzClear)=\"props['onClear'] && props['onClear'](field)\"\n (nzVisibleChange)=\"props['visibleChange'] && props['visibleChange'](field, $event)\"\n (nzSelectionChange)=\"props['selectionChange'] && props['selectionChange'](field, $event)\"\n ></nz-cascader>`,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class FormlyFieldCascader\n extends FieldType<FieldTypeConfig<CascaderProps>>\n implements OnInit\n{\n override defaultOptions = {\n props: {\n placeholder: '请选择',\n allowClear: true,\n backdrop: false,\n changeOnSelect: false,\n expandTrigger: 'click' as const,\n labelProperty: 'label',\n showArrow: true,\n showInput: true,\n showSearch: false,\n size: 'default' as const,\n status: '' as const,\n valueProperty: 'value',\n cascaderOptions: []\n }\n };\n constructor(@Optional() public fieldTemplates: FormlyBoxTemplates) {\n super();\n }\n\n get nzNotFoundContent() {\n return resolveTplName(this.props, this.fieldTemplates, 'notFoundContent');\n }\n\n get nzExpandIcon() {\n return resolveTplName(this.props, this.fieldTemplates, 'expandIcon');\n }\n\n get nzLabelRender() {\n return resolveTplName(this.props, this.fieldTemplates, 'labelRender');\n }\n\n get nzOptionRender() {\n return resolveTplName(this.props, this.fieldTemplates, 'optionRender');\n }\n\n get nzSuffixIcon() {\n return resolveTplName(this.props, this.fieldTemplates, 'suffixIcon');\n }\n\n ngOnInit(): void {\n const options = this.props['cascaderOptions'];\n if (!options || options.length === 0) {\n this.props['cascaderOptions'] = this.props.options as NzSafeAny;\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { FormlyNzFormFieldModule } from 'ngx-formly-zorro-antd/form-field';\nimport { FormlyCommonModule } from 'ngx-formly-zorro-antd/common';\nimport { NzCascaderModule } from 'ng-zorro-antd/cascader';\nimport { FormlyFieldCascader } from './cascader.type';\n\n@NgModule({\n declarations: [FormlyFieldCascader],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n FormlyNzFormFieldModule,\n FormlyCommonModule,\n NzCascaderModule,\n\n FormlyModule.forChild({\n types: [\n {\n name: 'cascader',\n component: FormlyFieldCascader,\n wrappers: ['form-field']\n }\n ]\n })\n ]\n})\nexport class FormlyNzCascaderModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;AAiNM,MAAO,mBACX,SAAQ,SAAyC,CAAA;AAoBjD,IAAA,WAAA,CAA+B,cAAkC,EAAA;AAC/D,QAAA,KAAK,EAAE,CAAC;QADqB,IAAc,CAAA,cAAA,GAAd,cAAc,CAAoB;AAjBxD,QAAA,IAAA,CAAA,cAAc,GAAG;AACxB,YAAA,KAAK,EAAE;AACL,gBAAA,WAAW,EAAE,KAAK;AAClB,gBAAA,UAAU,EAAE,IAAI;AAChB,gBAAA,QAAQ,EAAE,KAAK;AACf,gBAAA,cAAc,EAAE,KAAK;AACrB,gBAAA,aAAa,EAAE,OAAgB;AAC/B,gBAAA,aAAa,EAAE,OAAO;AACtB,gBAAA,SAAS,EAAE,IAAI;AACf,gBAAA,SAAS,EAAE,IAAI;AACf,gBAAA,UAAU,EAAE,KAAK;AACjB,gBAAA,IAAI,EAAE,SAAkB;AACxB,gBAAA,MAAM,EAAE,EAAW;AACnB,gBAAA,aAAa,EAAE,OAAO;AACtB,gBAAA,eAAe,EAAE,EAAE;AACpB,aAAA;SACF,CAAC;KAGD;AAED,IAAA,IAAI,iBAAiB,GAAA;AACnB,QAAA,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,E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AAA,EAAA,CAAA,CAAA,EAAA;;2FAGO,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBApBlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,mBAAmB,CAAC;AACnC,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBACnB,uBAAuB;wBACvB,kBAAkB;wBAClB,gBAAgB;wBAEhB,YAAY,CAAC,QAAQ,CAAC;AACpB,4BAAA,KAAK,EAAE;AACL,gCAAA;AACE,oCAAA,IAAI,EAAE,UAAU;AAChB,oCAAA,SAAS,EAAE,mBAAmB;oCAC9B,QAAQ,EAAE,CAAC,YAAY,CAAC;AACzB,iCAAA;AACF,6BAAA;yBACF,CAAC;AACH,qBAAA;AACF,iBAAA,CAAA;;;AC5BD;;AAEG;;;;"}
|
@@ -127,6 +127,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImpor
|
|
127
127
|
function getTplName(propName) {
|
128
128
|
return `${propName}Name`;
|
129
129
|
}
|
130
|
+
/**
|
131
|
+
* 获取模板名称
|
132
|
+
* @param value
|
133
|
+
* @param propName
|
134
|
+
* @param propTemplateName 模板属性名称
|
135
|
+
*/
|
136
|
+
function hasTplNameValue(value, propName, propTemplateName) {
|
137
|
+
const tplName = propTemplateName || getTplName(propName);
|
138
|
+
return value[propName] || value[tplName];
|
139
|
+
}
|
130
140
|
/**
|
131
141
|
* 处理属性为模板类型, 根据模板名称处理成模板对象
|
132
142
|
* @param value 数据对象
|
@@ -170,5 +180,5 @@ function resolveTplNameArray(value, fieldTemplates, propName, propTemplateName)
|
|
170
180
|
* Generated bundle index. Do not edit.
|
171
181
|
*/
|
172
182
|
|
173
|
-
export { FormlyBoxTemplates, FormlyCommonModule, getTplName, resolveTplName, resolveTplNameArray };
|
183
|
+
export { FormlyBoxTemplates, FormlyCommonModule, getTplName, hasTplNameValue, resolveTplName, resolveTplNameArray };
|
174
184
|
//# sourceMappingURL=ngx-formly-zorro-antd-common.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ngx-formly-zorro-antd-common.mjs","sources":["../../../../packages/formlyantd/common/formly-box-templates.directive.ts","../../../../packages/formlyantd/common/common.module.ts","../../../../packages/formlyantd/common/formly-utils.ts","../../../../packages/formlyantd/common/ngx-formly-zorro-antd-common.ts"],"sourcesContent":["import {\n AfterContentInit,\n ContentChildren,\n Directive,\n EventEmitter,\n Input,\n OnChanges,\n Output,\n QueryList,\n SimpleChange,\n SimpleChanges,\n TemplateRef\n} from '@angular/core';\nimport { NamedTemplate } from '@pkt/ng.core';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[formly-box]',\n standalone: true,\n exportAs: 'FormlyBox'\n})\nexport class FormlyBoxTemplates implements AfterContentInit, OnChanges {\n private tplMap = new Map<string, TemplateRef<NzSafeAny>>();\n @Input('formly-box') templateList?: TemplateList;\n @Output() templateChange = new EventEmitter<Map<string, TemplateRef<NzSafeAny>>>();\n @ContentChildren(NamedTemplate) namedTemplate!: QueryList<NamedTemplate<NzSafeAny>>;\n\n get templates(): Map<string, TemplateRef<NzSafeAny>> {\n return this.tplMap;\n }\n\n /**\n * 根据模板名称获取TemplateRef\n * @param templateName 模板名称\n */\n get(templateName: string): TemplateRef<NzSafeAny> | undefined {\n return this.tplMap.get(templateName);\n }\n\n ngAfterContentInit(): void {\n this.update();\n this.namedTemplate.changes.subscribe(() => {\n this.update();\n });\n }\n update(emitChange = true) {\n this.tplMap.clear();\n this.mergeTemplate(this.tplMap, emitChange);\n }\n\n ngOnChanges(changes: { [K in keyof this]?: SimpleChange } & SimpleChanges): void {\n if (changes.templateList && !changes.templateList.isFirstChange()) {\n this.update();\n }\n }\n\n /**\n * 合并参数模板\n * @param tplMap\n * @param emitChange\n */\n mergeTemplate(tplMap: Map<string, TemplateRef<NzSafeAny>>, emitChange = true) {\n this.mergeTemplates(tplMap, this.templateList);\n this.mergeQueryTemplate(tplMap, this.namedTemplate);\n\n if (emitChange) {\n this.templateChange.emit(tplMap);\n }\n }\n\n /**\n * 合并content 模板\n * @param tplMap\n * @param templateList\n * @private\n */\n private mergeQueryTemplate(\n tplMap: Map<string, TemplateRef<NzSafeAny>>,\n templateList?: QueryList<NamedTemplate<NzSafeAny>>\n ): void {\n if (templateList) {\n templateList.forEach(v => {\n tplMap.set(v.named, v.template);\n });\n }\n }\n\n /**\n * 合并模板列表\n * @param tplMap 模板Map\n * @param templateList\n */\n private mergeTemplates(\n tplMap: Map<string, TemplateRef<NzSafeAny>>,\n templateList?: TemplateList\n ): void {\n if (!templateList) {\n return;\n }\n\n if (templateList instanceof TemplateRef) {\n const namedTpl = new NamedTemplate(templateList);\n namedTpl.resolveName();\n tplMap.set(namedTpl.named, namedTpl.template);\n return;\n }\n\n templateList.forEach(v => {\n if (v instanceof NamedTemplate) {\n tplMap.set(v.named, v.template);\n } else {\n const namedTpl = new NamedTemplate(v);\n namedTpl.resolveName();\n tplMap.set(namedTpl.named, namedTpl.template);\n }\n });\n\n return;\n }\n}\n\n/**\n * 模板列表\n */\nexport type TemplateList =\n | QueryList<TemplateRef<NzSafeAny>>\n | QueryList<NamedTemplate<NzSafeAny>>\n | NamedTemplate<NzSafeAny>[]\n | TemplateRef<NzSafeAny>;\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormlyBoxTemplates } from './formly-box-templates.directive';\nimport { NamedTemplate } from '@pkt/ng.core';\n\nconst COMPONENT = [FormlyBoxTemplates, NamedTemplate];\n\n@NgModule({\n imports: [CommonModule, ...COMPONENT],\n exports: COMPONENT\n})\nexport class FormlyCommonModule {}\n","import { TemplateRef } from '@angular/core';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\nimport { FormlyBoxTemplates } from './formly-box-templates.directive';\n\n/**\n * 根据属性名获取模板名称\n * @param propName 属性名\n */\nexport function getTplName(propName: string) {\n return `${propName}Name`;\n}\n\n/**\n * 处理属性为模板类型, 根据模板名称处理成模板对象\n * @param value 数据对象\n * @param fieldTemplates 模板容器\n * @param propName 属性名\n * @param propTemplateName 模板属性名称\n */\nexport function resolveTplName<T = NzSafeAny>(\n value: NzSafeAny,\n fieldTemplates: FormlyBoxTemplates,\n propName: string,\n propTemplateName?: string\n): TemplateRef<T> | undefined {\n if (value[propName]) {\n return value[propName];\n }\n if (!fieldTemplates) {\n return undefined;\n }\n const tplName = propTemplateName || getTplName(propName);\n return fieldTemplates.get(value[tplName]);\n}\n\n/**\n * 处理属性为模板类型, 根据模板名称处理成模板对象列表\n * @param value 数据对象\n * @param fieldTemplates 模板容器\n * @param propName 属性名\n * @param propTemplateName 模板属性名称\n */\nexport function resolveTplNameArray<T = NzSafeAny>(\n value: NzSafeAny,\n fieldTemplates: FormlyBoxTemplates,\n propName: string,\n propTemplateName?: string\n): TemplateRef<T>[] {\n if (value[propName] != null) {\n return value[propName];\n }\n if (!fieldTemplates) {\n return [];\n }\n const tplName = propTemplateName || getTplName(propName);\n const tplValue = value[tplName];\n if (Array.isArray(tplValue)) {\n return tplValue.map(key => fieldTemplates.get(key)).filter(tpl => tpl) as TemplateRef<T>[];\n }\n return [];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MAsBa,kBAAkB,CAAA;AAN/B,IAAA,WAAA,GAAA;AAOU,QAAA,IAAA,CAAA,MAAM,GAAG,IAAI,GAAG,EAAkC,CAAC;AAEjD,QAAA,IAAA,CAAA,cAAc,GAAG,IAAI,YAAY,EAAuC,CAAC;AA+FpF,KAAA;AA5FC,IAAA,IAAI,SAAS,GAAA;QACX,OAAO,IAAI,CAAC,MAAM,CAAC;KACpB;AAED;;;AAGG;AACH,IAAA,GAAG,CAAC,YAAoB,EAAA;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;KACtC;IAED,kBAAkB,GAAA;QA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,EAAE;AACnB,QAAA,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;AACxB,KAAA;IACD,IAAI,CAAC,cAAc,EAAE;AACnB,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;IACD,MAAM,OAAO,GAAG,gBAAgB,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC;IACzD,OAAO,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;AAMG;AACG,SAAU,mBAAmB,CACjC,KAAgB,EAChB,cAAkC,EAClC,QAAgB,EAChB,gBAAyB,EAAA;AAEzB,IAAA,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE;AAC3B,QAAA,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;AACxB,KAAA;IACD,IAAI,CAAC,cAAc,EAAE;AACnB,QAAA,OAAO,EAAE,CAAC;AACX,KAAA;IACD,MAAM,OAAO,GAAG,gBAAgB,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC;AACzD,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;AAChC,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAC3B,OAAO,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAqB,CAAC;AAC5F,KAAA;AACD,IAAA,OAAO,EAAE,CAAC;AACZ;;AC5DA;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"ngx-formly-zorro-antd-common.mjs","sources":["../../../../packages/formlyantd/common/formly-box-templates.directive.ts","../../../../packages/formlyantd/common/common.module.ts","../../../../packages/formlyantd/common/formly-utils.ts","../../../../packages/formlyantd/common/ngx-formly-zorro-antd-common.ts"],"sourcesContent":["import {\n AfterContentInit,\n ContentChildren,\n Directive,\n EventEmitter,\n Input,\n OnChanges,\n Output,\n QueryList,\n SimpleChange,\n SimpleChanges,\n TemplateRef\n} from '@angular/core';\nimport { NamedTemplate } from '@pkt/ng.core';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[formly-box]',\n standalone: true,\n exportAs: 'FormlyBox'\n})\nexport class FormlyBoxTemplates implements AfterContentInit, OnChanges {\n private tplMap = new Map<string, TemplateRef<NzSafeAny>>();\n @Input('formly-box') templateList?: TemplateList;\n @Output() templateChange = new EventEmitter<Map<string, TemplateRef<NzSafeAny>>>();\n @ContentChildren(NamedTemplate) namedTemplate!: QueryList<NamedTemplate<NzSafeAny>>;\n\n get templates(): Map<string, TemplateRef<NzSafeAny>> {\n return this.tplMap;\n }\n\n /**\n * 根据模板名称获取TemplateRef\n * @param templateName 模板名称\n */\n get(templateName: string): TemplateRef<NzSafeAny> | undefined {\n return this.tplMap.get(templateName);\n }\n\n ngAfterContentInit(): void {\n this.update();\n this.namedTemplate.changes.subscribe(() => {\n this.update();\n });\n }\n update(emitChange = true) {\n this.tplMap.clear();\n this.mergeTemplate(this.tplMap, emitChange);\n }\n\n ngOnChanges(changes: { [K in keyof this]?: SimpleChange } & SimpleChanges): void {\n if (changes.templateList && !changes.templateList.isFirstChange()) {\n this.update();\n }\n }\n\n /**\n * 合并参数模板\n * @param tplMap\n * @param emitChange\n */\n mergeTemplate(tplMap: Map<string, TemplateRef<NzSafeAny>>, emitChange = true) {\n this.mergeTemplates(tplMap, this.templateList);\n this.mergeQueryTemplate(tplMap, this.namedTemplate);\n\n if (emitChange) {\n this.templateChange.emit(tplMap);\n }\n }\n\n /**\n * 合并content 模板\n * @param tplMap\n * @param templateList\n * @private\n */\n private mergeQueryTemplate(\n tplMap: Map<string, TemplateRef<NzSafeAny>>,\n templateList?: QueryList<NamedTemplate<NzSafeAny>>\n ): void {\n if (templateList) {\n templateList.forEach(v => {\n tplMap.set(v.named, v.template);\n });\n }\n }\n\n /**\n * 合并模板列表\n * @param tplMap 模板Map\n * @param templateList\n */\n private mergeTemplates(\n tplMap: Map<string, TemplateRef<NzSafeAny>>,\n templateList?: TemplateList\n ): void {\n if (!templateList) {\n return;\n }\n\n if (templateList instanceof TemplateRef) {\n const namedTpl = new NamedTemplate(templateList);\n namedTpl.resolveName();\n tplMap.set(namedTpl.named, namedTpl.template);\n return;\n }\n\n templateList.forEach(v => {\n if (v instanceof NamedTemplate) {\n tplMap.set(v.named, v.template);\n } else {\n const namedTpl = new NamedTemplate(v);\n namedTpl.resolveName();\n tplMap.set(namedTpl.named, namedTpl.template);\n }\n });\n\n return;\n }\n}\n\n/**\n * 模板列表\n */\nexport type TemplateList =\n | QueryList<TemplateRef<NzSafeAny>>\n | QueryList<NamedTemplate<NzSafeAny>>\n | NamedTemplate<NzSafeAny>[]\n | TemplateRef<NzSafeAny>;\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormlyBoxTemplates } from './formly-box-templates.directive';\nimport { NamedTemplate } from '@pkt/ng.core';\n\nconst COMPONENT = [FormlyBoxTemplates, NamedTemplate];\n\n@NgModule({\n imports: [CommonModule, ...COMPONENT],\n exports: COMPONENT\n})\nexport class FormlyCommonModule {}\n","import { TemplateRef } from '@angular/core';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\nimport { FormlyBoxTemplates } from './formly-box-templates.directive';\n\n/**\n * 根据属性名获取模板名称\n * @param propName 属性名\n */\nexport function getTplName(propName: string) {\n return `${propName}Name`;\n}\n\n/**\n * 获取模板名称\n * @param value\n * @param propName\n * @param propTemplateName 模板属性名称\n */\nexport function hasTplNameValue(\n value: NzSafeAny,\n propName: string,\n propTemplateName?: string\n): boolean {\n const tplName = propTemplateName || getTplName(propName);\n return value[propName] || value[tplName];\n}\n\n/**\n * 处理属性为模板类型, 根据模板名称处理成模板对象\n * @param value 数据对象\n * @param fieldTemplates 模板容器\n * @param propName 属性名\n * @param propTemplateName 模板属性名称\n */\nexport function resolveTplName<T = NzSafeAny>(\n value: NzSafeAny,\n fieldTemplates: FormlyBoxTemplates,\n propName: string,\n propTemplateName?: string\n): TemplateRef<T> | undefined {\n if (value[propName]) {\n return value[propName];\n }\n if (!fieldTemplates) {\n return undefined;\n }\n const tplName = propTemplateName || getTplName(propName);\n return fieldTemplates.get(value[tplName]);\n}\n\n/**\n * 处理属性为模板类型, 根据模板名称处理成模板对象列表\n * @param value 数据对象\n * @param fieldTemplates 模板容器\n * @param propName 属性名\n * @param propTemplateName 模板属性名称\n */\nexport function resolveTplNameArray<T = NzSafeAny>(\n value: NzSafeAny,\n fieldTemplates: FormlyBoxTemplates,\n propName: string,\n propTemplateName?: string\n): TemplateRef<T>[] {\n if (value[propName] != null) {\n return value[propName];\n }\n if (!fieldTemplates) {\n return [];\n }\n const tplName = propTemplateName || getTplName(propName);\n const tplValue = value[tplName];\n if (Array.isArray(tplValue)) {\n return tplValue.map(key => fieldTemplates.get(key)).filter(tpl => tpl) as TemplateRef<T>[];\n }\n return [];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MAsBa,kBAAkB,CAAA;AAN/B,IAAA,WAAA,GAAA;AAOU,QAAA,IAAA,CAAA,MAAM,GAAG,IAAI,GAAG,EAAkC,CAAC;AAEjD,QAAA,IAAA,CAAA,cAAc,GAAG,IAAI,YAAY,EAAuC,CAAC;AA+FpF,KAAA;AA5FC,IAAA,IAAI,SAAS,GAAA;QACX,OAAO,IAAI,CAAC,MAAM,CAAC;KACpB;AAED;;;AAGG;AACH,IAAA,GAAG,CAAC,YAAoB,EAAA;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;KACtC;IAED,kBAAkB,GAAA;QAChB,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,MAAK;YACxC,IAAI,CAAC,MAAM,EAAE,CA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