@ngx-formly/core 7.1.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/fesm2022/ngx-formly-core-json-schema.mjs +159 -39
- package/fesm2022/ngx-formly-core-json-schema.mjs.map +1 -1
- package/fesm2022/ngx-formly-core-preset.mjs +4 -4
- package/fesm2022/ngx-formly-core-preset.mjs.map +1 -1
- package/fesm2022/ngx-formly-core-select.mjs +28 -21
- package/fesm2022/ngx-formly-core-select.mjs.map +1 -1
- package/fesm2022/ngx-formly-core-testing.mjs +3 -3
- package/fesm2022/ngx-formly-core-testing.mjs.map +1 -1
- package/fesm2022/ngx-formly-core.mjs +129 -73
- package/fesm2022/ngx-formly-core.mjs.map +1 -1
- package/json-schema/formly-json-schema.service.d.ts +5 -0
- package/lib/components/formly.field.d.ts +7 -4
- package/lib/core.d.ts +1 -1
- package/lib/core.module.d.ts +7 -0
- package/lib/templates/field-array.type.d.ts +1 -1
- package/lib/templates/field.type.d.ts +1 -1
- package/lib/templates/field.wrapper.d.ts +1 -1
- package/lib/templates/formly.attributes.d.ts +5 -2
- package/lib/templates/formly.validation-message.d.ts +2 -2
- package/package.json +2 -12
- package/select/select-options.pipe.d.ts +1 -0
- package/esm2022/json-schema/formly-json-schema.service.mjs +0 -728
- package/esm2022/json-schema/ngx-formly-core-json-schema.mjs +0 -5
- package/esm2022/json-schema/public_api.mjs +0 -2
- package/esm2022/lib/components/formly.field.mjs +0 -292
- package/esm2022/lib/components/formly.form.mjs +0 -171
- package/esm2022/lib/components/formly.template.mjs +0 -36
- package/esm2022/lib/core.config.mjs +0 -66
- package/esm2022/lib/core.mjs +0 -20
- package/esm2022/lib/core.module.mjs +0 -74
- package/esm2022/lib/extensions/core/core.mjs +0 -144
- package/esm2022/lib/extensions/field-expression/field-expression.mjs +0 -8
- package/esm2022/lib/extensions/field-expression/utils.mjs +0 -459
- package/esm2022/lib/extensions/field-expression-legacy/field-expression.mjs +0 -249
- package/esm2022/lib/extensions/field-expression-legacy/utils.mjs +0 -20
- package/esm2022/lib/extensions/field-form/field-form.mjs +0 -141
- package/esm2022/lib/extensions/field-form/utils.mjs +0 -100
- package/esm2022/lib/extensions/field-validation/field-validation.mjs +0 -135
- package/esm2022/lib/models/config.mjs +0 -2
- package/esm2022/lib/models/fieldconfig.cache.mjs +0 -2
- package/esm2022/lib/models/fieldconfig.mjs +0 -2
- package/esm2022/lib/models/index.mjs +0 -4
- package/esm2022/lib/services/formly.builder.mjs +0 -98
- package/esm2022/lib/services/formly.config.mjs +0 -236
- package/esm2022/lib/templates/field-array.type.mjs +0 -84
- package/esm2022/lib/templates/field-template.type.mjs +0 -34
- package/esm2022/lib/templates/field.type.mjs +0 -57
- package/esm2022/lib/templates/field.wrapper.mjs +0 -21
- package/esm2022/lib/templates/formly.attributes.mjs +0 -201
- package/esm2022/lib/templates/formly.group.mjs +0 -31
- package/esm2022/lib/templates/formly.validation-message.mjs +0 -84
- package/esm2022/lib/utils.mjs +0 -313
- package/esm2022/ngx-formly-core.mjs +0 -5
- package/esm2022/preset/ngx-formly-core-preset.mjs +0 -5
- package/esm2022/preset/preset-substitution.extension.mjs +0 -30
- package/esm2022/preset/preset.config.mjs +0 -11
- package/esm2022/preset/preset.module.mjs +0 -18
- package/esm2022/preset/public_api.mjs +0 -3
- package/esm2022/public_api.mjs +0 -5
- package/esm2022/select/ngx-formly-core-select.mjs +0 -5
- package/esm2022/select/public_api.mjs +0 -3
- package/esm2022/select/select-options.pipe.mjs +0 -108
- package/esm2022/select/select.module.mjs +0 -16
- package/esm2022/testing/component-factory.mjs +0 -86
- package/esm2022/testing/ngx-formly-core-testing.mjs +0 -5
- package/esm2022/testing/public_api.mjs +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Pipe, NgModule } from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { isObservable, BehaviorSubject } from 'rxjs';
|
|
4
4
|
import { map, filter, tap } from 'rxjs/operators';
|
|
5
5
|
|
|
6
6
|
class FormlySelectOptionsPipe {
|
|
7
7
|
transform(options, field) {
|
|
8
|
-
if (!(options
|
|
8
|
+
if (!isObservable(options)) {
|
|
9
9
|
options = this.observableOf(options, field);
|
|
10
10
|
}
|
|
11
11
|
else {
|
|
@@ -21,19 +21,25 @@ class FormlySelectOptionsPipe {
|
|
|
21
21
|
const opts = [];
|
|
22
22
|
const groups = {};
|
|
23
23
|
options?.forEach((option) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
if (to.mapProp) {
|
|
25
|
+
const mapped = to.mapProp(option);
|
|
26
|
+
opts.push(mapped);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
const o = this.transformOption(option, to);
|
|
30
|
+
if (o.group) {
|
|
31
|
+
const id = groups[o.label];
|
|
32
|
+
if (id === undefined) {
|
|
33
|
+
groups[o.label] = opts.push(o) - 1;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
o.group.forEach((o) => opts[id].group.push(o));
|
|
37
|
+
}
|
|
29
38
|
}
|
|
30
39
|
else {
|
|
31
|
-
|
|
40
|
+
opts.push(o);
|
|
32
41
|
}
|
|
33
42
|
}
|
|
34
|
-
else {
|
|
35
|
-
opts.push(o);
|
|
36
|
-
}
|
|
37
43
|
});
|
|
38
44
|
return opts;
|
|
39
45
|
}
|
|
@@ -63,6 +69,7 @@ class FormlySelectOptionsPipe {
|
|
|
63
69
|
labelProp: selectPropFn(props.labelProp || 'label'),
|
|
64
70
|
valueProp: selectPropFn(props.valueProp || 'value'),
|
|
65
71
|
disabledProp: selectPropFn(props.disabledProp || 'disabled'),
|
|
72
|
+
mapProp: props.mapProp,
|
|
66
73
|
};
|
|
67
74
|
}
|
|
68
75
|
dispose() {
|
|
@@ -91,28 +98,28 @@ class FormlySelectOptionsPipe {
|
|
|
91
98
|
this._options = new BehaviorSubject(options);
|
|
92
99
|
return this._options.asObservable();
|
|
93
100
|
}
|
|
94
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
95
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
101
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormlySelectOptionsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
102
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.25", ngImport: i0, type: FormlySelectOptionsPipe, isStandalone: true, name: "formlySelectOptions" }); }
|
|
96
103
|
}
|
|
97
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormlySelectOptionsPipe, decorators: [{
|
|
98
105
|
type: Pipe,
|
|
99
106
|
args: [{ name: 'formlySelectOptions', standalone: true }]
|
|
100
107
|
}] });
|
|
101
108
|
class LegacyFormlySelectOptionsPipe extends FormlySelectOptionsPipe {
|
|
102
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
103
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
109
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LegacyFormlySelectOptionsPipe, deps: null, target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
110
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.25", ngImport: i0, type: LegacyFormlySelectOptionsPipe, isStandalone: false, name: "formlySelectOptions" }); }
|
|
104
111
|
}
|
|
105
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LegacyFormlySelectOptionsPipe, decorators: [{
|
|
106
113
|
type: Pipe,
|
|
107
114
|
args: [{ name: 'formlySelectOptions', standalone: false }]
|
|
108
115
|
}] });
|
|
109
116
|
|
|
110
117
|
class FormlySelectModule {
|
|
111
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
112
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
113
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
118
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormlySelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
119
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.25", ngImport: i0, type: FormlySelectModule, declarations: [LegacyFormlySelectOptionsPipe], exports: [LegacyFormlySelectOptionsPipe] }); }
|
|
120
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormlySelectModule }); }
|
|
114
121
|
}
|
|
115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
122
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormlySelectModule, decorators: [{
|
|
116
123
|
type: NgModule,
|
|
117
124
|
args: [{
|
|
118
125
|
declarations: [LegacyFormlySelectOptionsPipe],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-formly-core-select.mjs","sources":["../../../../src/core/select/src/select-options.pipe.ts","../../../../src/core/select/src/select.module.ts","../../../../src/core/select/src/ngx-formly-core-select.ts"],"sourcesContent":["import { OnDestroy, Pipe, PipeTransform } from '@angular/core';\nimport { BehaviorSubject, Observable, Subscription } from 'rxjs';\nimport { filter, map, tap } from 'rxjs/operators';\nimport { FormlyFieldConfig, FormlyFieldProps } from '@ngx-formly/core';\n\nexport interface FormlySelectOption {\n label: string;\n disabled?: boolean;\n value?: any;\n group?: FormlySelectOption[];\n}\n\nexport interface FormlyFieldSelectProps extends FormlyFieldProps {\n groupProp?: string | ((option: any) => string);\n labelProp?: string | ((option: any) => string);\n valueProp?: string | ((option: any) => any);\n disabledProp?: string | ((option: any) => boolean);\n}\n\ntype ITransformOption = {\n labelProp: (option: any) => string;\n valueProp: (option: any) => any;\n disabledProp: (option: any) => boolean;\n groupProp: (option: any) => string;\n};\n\n@Pipe({ name: 'formlySelectOptions', standalone: true })\nexport class FormlySelectOptionsPipe implements PipeTransform, OnDestroy {\n private _subscription: Subscription;\n private _options: BehaviorSubject<any[]>;\n\n transform(options: any, field?: FormlyFieldConfig): Observable<FormlySelectOption[]> {\n if (!(options
|
|
1
|
+
{"version":3,"file":"ngx-formly-core-select.mjs","sources":["../../../../src/core/select/src/select-options.pipe.ts","../../../../src/core/select/src/select.module.ts","../../../../src/core/select/src/ngx-formly-core-select.ts"],"sourcesContent":["import { OnDestroy, Pipe, PipeTransform } from '@angular/core';\nimport { BehaviorSubject, isObservable, Observable, Subscription } from 'rxjs';\nimport { filter, map, tap } from 'rxjs/operators';\nimport { FormlyFieldConfig, FormlyFieldProps } from '@ngx-formly/core';\n\nexport interface FormlySelectOption {\n label: string;\n disabled?: boolean;\n value?: any;\n group?: FormlySelectOption[];\n}\n\nexport interface FormlyFieldSelectProps extends FormlyFieldProps {\n groupProp?: string | ((option: any) => string);\n labelProp?: string | ((option: any) => string);\n valueProp?: string | ((option: any) => any);\n disabledProp?: string | ((option: any) => boolean);\n mapProp?: (option: any) => FormlySelectOption;\n}\n\ntype ITransformOption = {\n labelProp: (option: any) => string;\n valueProp: (option: any) => any;\n disabledProp: (option: any) => boolean;\n groupProp: (option: any) => string;\n mapProp?: (option: any) => FormlySelectOption;\n};\n\n@Pipe({ name: 'formlySelectOptions', standalone: true })\nexport class FormlySelectOptionsPipe implements PipeTransform, OnDestroy {\n private _subscription: Subscription;\n private _options: BehaviorSubject<any[]>;\n\n transform(options: any, field?: FormlyFieldConfig): Observable<FormlySelectOption[]> {\n if (!isObservable(options)) {\n options = this.observableOf(options, field);\n } else {\n this.dispose();\n }\n\n return (options as Observable<any>).pipe(map((value) => this.transformOptions(value, field)));\n }\n\n ngOnDestroy(): void {\n this.dispose();\n }\n\n private transformOptions(options: any[], field?: FormlyFieldConfig): FormlySelectOption[] {\n const to = this.transformSelectProps(field);\n\n const opts: FormlySelectOption[] = [];\n const groups: { [id: string]: number } = {};\n\n options?.forEach((option) => {\n if (to.mapProp) {\n const mapped = to.mapProp(option);\n opts.push(mapped);\n } else {\n const o = this.transformOption(option, to);\n if (o.group) {\n const id = groups[o.label];\n if (id === undefined) {\n groups[o.label] = opts.push(o) - 1;\n } else {\n o.group.forEach((o) => opts[id].group.push(o));\n }\n } else {\n opts.push(o);\n }\n }\n });\n\n return opts;\n }\n\n private transformOption(option: any, props: ITransformOption): FormlySelectOption {\n const group = props.groupProp(option);\n if (Array.isArray(group)) {\n return {\n label: props.labelProp(option),\n group: group.map((opt) => this.transformOption(opt, props)),\n };\n }\n\n option = {\n label: props.labelProp(option),\n value: props.valueProp(option),\n disabled: !!props.disabledProp(option),\n };\n\n if (group) {\n return { label: group, group: [option] };\n }\n\n return option;\n }\n\n private transformSelectProps(field?: FormlyFieldConfig): ITransformOption {\n const props = field?.props || field?.templateOptions || {};\n const selectPropFn = (prop: any) => (typeof prop === 'function' ? prop : (o: any) => o[prop]);\n\n return {\n groupProp: selectPropFn(props.groupProp || 'group'),\n labelProp: selectPropFn(props.labelProp || 'label'),\n valueProp: selectPropFn(props.valueProp || 'value'),\n disabledProp: selectPropFn(props.disabledProp || 'disabled'),\n mapProp: props.mapProp,\n };\n }\n\n private dispose() {\n if (this._options) {\n this._options.complete();\n this._options = null;\n }\n\n if (this._subscription) {\n this._subscription.unsubscribe();\n this._subscription = null;\n }\n }\n\n private observableOf(options: any, f?: FormlyFieldConfig) {\n this.dispose();\n if (f && f.options && f.options.fieldChanges) {\n this._subscription = f.options.fieldChanges\n .pipe(\n filter(({ property, type, field }) => {\n return (\n type === 'expressionChanges' &&\n (property.indexOf('templateOptions.options') === 0 || property.indexOf('props.options') === 0) &&\n field === f &&\n Array.isArray(field.props.options) &&\n !!this._options\n );\n }),\n tap(() => this._options.next(f.props.options as any)),\n )\n .subscribe();\n }\n\n this._options = new BehaviorSubject(options);\n return this._options.asObservable();\n }\n}\n\n@Pipe({ name: 'formlySelectOptions', standalone: false })\nexport class LegacyFormlySelectOptionsPipe extends FormlySelectOptionsPipe implements PipeTransform, OnDestroy {}\n","import { NgModule } from '@angular/core';\nimport { LegacyFormlySelectOptionsPipe } from './select-options.pipe';\n\n@NgModule({\n declarations: [LegacyFormlySelectOptionsPipe],\n exports: [LegacyFormlySelectOptionsPipe],\n})\nexport class FormlySelectModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MA6Ba,uBAAuB,CAAA;IAIlC,SAAS,CAAC,OAAY,EAAE,KAAyB,EAAA;AAC/C,QAAA,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;YAC1B,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;QAC7C;aAAO;YACL,IAAI,CAAC,OAAO,EAAE;QAChB;QAEA,OAAQ,OAA2B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/F;IAEA,WAAW,GAAA;QACT,IAAI,CAAC,OAAO,EAAE;IAChB;IAEQ,gBAAgB,CAAC,OAAc,EAAE,KAAyB,EAAA;QAChE,MAAM,EAAE,GAAG,IAAI,CAAC,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AAA,CAAA,EAAE,IAAI,EAAE,qBAAqB,EAAE,UAAU,EAAE,IAAI,EAAE;;AAuHjD,MAAO,6BAA8B,SAAQ,uBAAuB,CAAA;+GAA7D,6BAA6B,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;6GAA7B,6BAA6B,EAAA,YAAA,EAAA,KAAA,EAAA,IAAA,EAAA,qBAAA,EAAA,CAAA,CAAA;;4FAA7B,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBADzC,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA,EAAE,IAAI,EAAE,qBAAqB,EAAE,UAAU,EAAE,KAAK,EAAE;;;MC3I3C,kBAAkB,CAAA;+GAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAAlB,kBAAkB,EAAA,YAAA,EAAA,CAHd,6BAA6B,CAAA,EAAA,OAAA,EAAA,CAClC,6BAA6B,CAAA,EAAA,CAAA,CAAA;gHAE5B,kBAAkB,EAAA,CAAA,CAAA;;4FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,6BAA6B,CAAC;oBAC7C,OAAO,EAAE,CAAC,6BAA6B,CAAC;AACzC,iBAAA;;;ACND;;AAEG;;;;"}
|
|
@@ -72,10 +72,10 @@ class TestComponent {
|
|
|
72
72
|
constructor(builder) {
|
|
73
73
|
this.builder = builder;
|
|
74
74
|
}
|
|
75
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
76
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
75
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TestComponent, deps: [{ token: i1.FormlyFormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
76
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: TestComponent, isStandalone: false, selector: "formly-test-component", providers: [FormlyFormBuilder], ngImport: i0, template: '', isInline: true }); }
|
|
77
77
|
}
|
|
78
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
78
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TestComponent, decorators: [{
|
|
79
79
|
type: Component,
|
|
80
80
|
args: [{
|
|
81
81
|
selector: 'formly-test-component',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-formly-core-testing.mjs","sources":["../../../../src/core/testing/src/component-factory.ts","../../../../src/core/testing/src/ngx-formly-core-testing.ts"],"sourcesContent":["import { TestBed, ComponentFixture } from '@angular/core/testing';\nimport { Component, DebugElement, NgModule } from '@angular/core';\nimport { FormlyModule, FormlyFormBuilder, FormlyFieldConfig, ConfigOption } from '@ngx-formly/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { By } from '@angular/platform-browser';\n\nfunction setInputs<T>(fixture: ComponentFixture<T>, inputs: T, detectChanges = true) {\n (Object.keys(inputs) as (keyof T)[]).forEach((input) => {\n fixture.componentInstance[input] = inputs[input];\n });\n\n if (detectChanges !== false) {\n fixture.detectChanges();\n }\n}\n\ninterface IComponentOptions<T> extends NgModule {\n template?: string;\n inputs?: T;\n config?: ConfigOption;\n detectChanges?: boolean;\n}\ninterface IFormlyDebugElement<E> extends DebugElement {\n readonly nativeElement: E;\n}\n\nexport function createComponent<T>({\n template,\n inputs,\n config,\n detectChanges,\n imports,\n declarations,\n providers,\n}: IComponentOptions<T>) {\n TestBed.configureTestingModule({\n declarations: [TestComponent, ...(declarations || [])],\n imports: [ReactiveFormsModule, FormlyModule.forRoot(config), ...(imports || [])],\n providers: providers || [],\n teardown: { destroyAfterEach: false },\n }).overrideComponent(TestComponent, {\n set: {\n template,\n inputs: Object.keys(inputs),\n },\n });\n\n const fixture = TestBed.createComponent(TestComponent) as ComponentFixture<T>;\n (Object.keys(inputs) as (keyof T)[]).forEach((input) => {\n fixture.componentInstance[input] = inputs[input];\n });\n\n setInputs(fixture, inputs, detectChanges);\n\n type FixtureUtils = T & {\n fixture: ComponentFixture<T>;\n detectChanges: (typeof fixture)['detectChanges'];\n setInputs: (inputs: Partial<T>) => void;\n query: <E extends Element = Element>(selector: string) => IFormlyDebugElement<E>;\n queryAll: <E extends Element = Element>(selector: string) => IFormlyDebugElement<E>[];\n };\n\n const utils = {\n fixture,\n detectChanges: () => fixture.detectChanges(),\n setInputs: (props) => setInputs(fixture, props),\n query: (selector: string) => fixture.debugElement.query(By.css(selector)),\n queryAll: (selector: string) => fixture.debugElement.queryAll(By.css(selector)),\n } as FixtureUtils;\n\n (Object.keys(inputs) as (keyof T)[]).forEach((input) => {\n Object.defineProperty(utils, input, {\n get: () => fixture.componentInstance[input],\n });\n });\n\n return utils;\n}\n\nexport function createFieldComponent(\n field: FormlyFieldConfig,\n config: IComponentOptions<{ field: FormlyFieldConfig }> = {},\n) {\n const model = field?.model || {};\n const options = field?.options || {};\n delete (field as any)?.model;\n delete (field as any)?.options;\n\n const utils = createComponent<{ field: FormlyFieldConfig }>({\n template: '<formly-field [field]=\"field\"></formly-field>',\n inputs: { field },\n ...config,\n detectChanges: false,\n });\n const builder = (utils.fixture.componentRef.instance as any).builder;\n builder.build({ model, options, fieldGroup: [field] });\n utils.detectChanges();\n\n const setInputs = utils.setInputs;\n utils.setInputs = (props) => {\n if (props.field) {\n builder.build(props.field);\n }\n\n setInputs(props);\n };\n\n return utils;\n}\n\n@Component({\n selector: 'formly-test-component',\n template: '',\n providers: [FormlyFormBuilder],\n standalone: false,\n})\nclass TestComponent {\n constructor(public builder?: FormlyFormBuilder) {}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;AAMA,SAAS,SAAS,CAAI,OAA4B,EAAE,MAAS,EAAE,aAAa,GAAG,IAAI,EAAA;IAChF,MAAM,CAAC,IAAI,CAAC,MAAM,CAAiB,CAAC,OAAO,CAAC,CAAC,KAAK,KAAI;QACrD,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;AAClD,
|
|
1
|
+
{"version":3,"file":"ngx-formly-core-testing.mjs","sources":["../../../../src/core/testing/src/component-factory.ts","../../../../src/core/testing/src/ngx-formly-core-testing.ts"],"sourcesContent":["import { TestBed, ComponentFixture } from '@angular/core/testing';\nimport { Component, DebugElement, NgModule } from '@angular/core';\nimport { FormlyModule, FormlyFormBuilder, FormlyFieldConfig, ConfigOption } from '@ngx-formly/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { By } from '@angular/platform-browser';\n\nfunction setInputs<T>(fixture: ComponentFixture<T>, inputs: T, detectChanges = true) {\n (Object.keys(inputs) as (keyof T)[]).forEach((input) => {\n fixture.componentInstance[input] = inputs[input];\n });\n\n if (detectChanges !== false) {\n fixture.detectChanges();\n }\n}\n\ninterface IComponentOptions<T> extends NgModule {\n template?: string;\n inputs?: T;\n config?: ConfigOption;\n detectChanges?: boolean;\n}\ninterface IFormlyDebugElement<E> extends DebugElement {\n readonly nativeElement: E;\n}\n\nexport function createComponent<T>({\n template,\n inputs,\n config,\n detectChanges,\n imports,\n declarations,\n providers,\n}: IComponentOptions<T>) {\n TestBed.configureTestingModule({\n declarations: [TestComponent, ...(declarations || [])],\n imports: [ReactiveFormsModule, FormlyModule.forRoot(config), ...(imports || [])],\n providers: providers || [],\n teardown: { destroyAfterEach: false },\n }).overrideComponent(TestComponent, {\n set: {\n template,\n inputs: Object.keys(inputs),\n },\n });\n\n const fixture = TestBed.createComponent(TestComponent) as ComponentFixture<T>;\n (Object.keys(inputs) as (keyof T)[]).forEach((input) => {\n fixture.componentInstance[input] = inputs[input];\n });\n\n setInputs(fixture, inputs, detectChanges);\n\n type FixtureUtils = T & {\n fixture: ComponentFixture<T>;\n detectChanges: (typeof fixture)['detectChanges'];\n setInputs: (inputs: Partial<T>) => void;\n query: <E extends Element = Element>(selector: string) => IFormlyDebugElement<E>;\n queryAll: <E extends Element = Element>(selector: string) => IFormlyDebugElement<E>[];\n };\n\n const utils = {\n fixture,\n detectChanges: () => fixture.detectChanges(),\n setInputs: (props) => setInputs(fixture, props),\n query: (selector: string) => fixture.debugElement.query(By.css(selector)),\n queryAll: (selector: string) => fixture.debugElement.queryAll(By.css(selector)),\n } as FixtureUtils;\n\n (Object.keys(inputs) as (keyof T)[]).forEach((input) => {\n Object.defineProperty(utils, input, {\n get: () => fixture.componentInstance[input],\n });\n });\n\n return utils;\n}\n\nexport function createFieldComponent(\n field: FormlyFieldConfig,\n config: IComponentOptions<{ field: FormlyFieldConfig }> = {},\n) {\n const model = field?.model || {};\n const options = field?.options || {};\n delete (field as any)?.model;\n delete (field as any)?.options;\n\n const utils = createComponent<{ field: FormlyFieldConfig }>({\n template: '<formly-field [field]=\"field\"></formly-field>',\n inputs: { field },\n ...config,\n detectChanges: false,\n });\n const builder = (utils.fixture.componentRef.instance as any).builder;\n builder.build({ model, options, fieldGroup: [field] });\n utils.detectChanges();\n\n const setInputs = utils.setInputs;\n utils.setInputs = (props) => {\n if (props.field) {\n builder.build(props.field);\n }\n\n setInputs(props);\n };\n\n return utils;\n}\n\n@Component({\n selector: 'formly-test-component',\n template: '',\n providers: [FormlyFormBuilder],\n standalone: false,\n})\nclass TestComponent {\n constructor(public builder?: FormlyFormBuilder) {}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;AAMA,SAAS,SAAS,CAAI,OAA4B,EAAE,MAAS,EAAE,aAAa,GAAG,IAAI,EAAA;IAChF,MAAM,CAAC,IAAI,CAAC,MAAM,CAAiB,CAAC,OAAO,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