@ngx-formly/core 7.0.0-alpha.1 → 7.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 +15 -11
- package/esm2022/lib/components/formly.field.mjs +2 -2
- package/esm2022/lib/components/formly.form.mjs +2 -1
- package/esm2022/lib/core.mjs +3 -3
- package/esm2022/lib/core.module.mjs +12 -12
- package/esm2022/lib/extensions/core/core.mjs +1 -5
- package/esm2022/lib/extensions/field-expression/field-expression.mjs +1 -5
- package/esm2022/lib/models/fieldconfig.cache.mjs +1 -1
- package/esm2022/lib/services/formly.builder.mjs +4 -6
- package/esm2022/lib/services/formly.config.mjs +22 -15
- package/esm2022/lib/templates/formly.attributes.mjs +16 -2
- package/esm2022/lib/templates/formly.group.mjs +10 -7
- package/esm2022/lib/templates/formly.validation-message.mjs +17 -2
- package/esm2022/lib/utils.mjs +2 -2
- package/esm2022/preset/public_api.mjs +2 -1
- package/esm2022/select/public_api.mjs +2 -2
- package/esm2022/select/select-options.pipe.mjs +11 -3
- package/esm2022/select/select.module.mjs +5 -5
- package/fesm2022/ngx-formly-core-preset.mjs +1 -1
- package/fesm2022/ngx-formly-core-select.mjs +14 -6
- package/fesm2022/ngx-formly-core-select.mjs.map +1 -1
- package/fesm2022/ngx-formly-core.mjs +76 -46
- package/fesm2022/ngx-formly-core.mjs.map +1 -1
- package/lib/core.d.ts +2 -2
- package/lib/core.module.d.ts +3 -3
- package/lib/models/fieldconfig.cache.d.ts +0 -6
- package/lib/services/formly.config.d.ts +3 -0
- package/lib/templates/formly.attributes.d.ts +5 -1
- package/lib/templates/formly.validation-message.d.ts +5 -1
- package/package.json +1 -1
- package/preset/public_api.d.ts +1 -0
- package/select/public_api.d.ts +1 -1
- package/select/select-options.pipe.d.ts +5 -1
- package/select/select.module.d.ts +1 -1
|
@@ -5,8 +5,8 @@ import * as i2 from '@angular/forms';
|
|
|
5
5
|
import { AbstractControl, UntypedFormArray, UntypedFormGroup, FormControl, UntypedFormControl, Validators, NgControl } from '@angular/forms';
|
|
6
6
|
import { tap, map, distinctUntilChanged, startWith, debounceTime, filter, switchMap, take } from 'rxjs/operators';
|
|
7
7
|
import * as i1 from '@angular/platform-browser';
|
|
8
|
-
import * as
|
|
9
|
-
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
8
|
+
import * as i2$1 from '@angular/common';
|
|
9
|
+
import { DOCUMENT, AsyncPipe, CommonModule } from '@angular/common';
|
|
10
10
|
|
|
11
11
|
function disableTreeValidityCall(form, callback) {
|
|
12
12
|
const _updateTreeValidity = form._updateTreeValidity.bind(form);
|
|
@@ -314,7 +314,7 @@ function isHiddenField(field) {
|
|
|
314
314
|
return !setDefaultValue;
|
|
315
315
|
}
|
|
316
316
|
function isSignalRequired() {
|
|
317
|
-
return +VERSION.major >= 18 && +VERSION.minor >= 1;
|
|
317
|
+
return +VERSION.major > 18 || (+VERSION.major >= 18 && +VERSION.minor >= 1);
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
function evalStringExpression(expression, argNames) {
|
|
@@ -497,10 +497,6 @@ class FieldExpressionExtension {
|
|
|
497
497
|
}
|
|
498
498
|
checkLocked = false;
|
|
499
499
|
};
|
|
500
|
-
field.options._checkField = (f, ignoreCache) => {
|
|
501
|
-
console.warn(`Formly: 'options._checkField' is deprecated since v6.0, use 'options.checkExpressions' instead.`);
|
|
502
|
-
field.options.checkExpressions(f, ignoreCache);
|
|
503
|
-
};
|
|
504
500
|
}
|
|
505
501
|
}
|
|
506
502
|
parseExpressions(field, path, expr) {
|
|
@@ -737,10 +733,6 @@ class CoreExtension {
|
|
|
737
733
|
if (!options._hiddenFieldsForCheck) {
|
|
738
734
|
options._hiddenFieldsForCheck = [];
|
|
739
735
|
}
|
|
740
|
-
options._markForCheck = (f) => {
|
|
741
|
-
console.warn(`Formly: 'options._markForCheck' is deprecated since v6.0, use 'options.detectChanges' instead.`);
|
|
742
|
-
options.detectChanges(f);
|
|
743
|
-
};
|
|
744
736
|
options._detectChanges = (f) => {
|
|
745
737
|
if (f._componentRefs) {
|
|
746
738
|
markFieldForCheck(f);
|
|
@@ -1194,6 +1186,7 @@ class FormlyConfig {
|
|
|
1194
1186
|
this.extensions = {};
|
|
1195
1187
|
this.presets = {};
|
|
1196
1188
|
this.extensionsByPriority = {};
|
|
1189
|
+
this.componentRefs = {};
|
|
1197
1190
|
}
|
|
1198
1191
|
addConfig(config) {
|
|
1199
1192
|
if (Array.isArray(config)) {
|
|
@@ -1292,22 +1285,28 @@ class FormlyConfig {
|
|
|
1292
1285
|
if (!type) {
|
|
1293
1286
|
return null;
|
|
1294
1287
|
}
|
|
1295
|
-
if (!type.component
|
|
1296
|
-
return type._componentRef;
|
|
1297
|
-
}
|
|
1298
|
-
const { _viewContainerRef, _injector } = field.options;
|
|
1299
|
-
if (!_viewContainerRef || !_injector) {
|
|
1288
|
+
if (!type.component) {
|
|
1300
1289
|
return null;
|
|
1301
1290
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1291
|
+
if (!this.componentRefs[type.name]) {
|
|
1292
|
+
const { _viewContainerRef, _injector } = field.options;
|
|
1293
|
+
if (!_viewContainerRef || !_injector) {
|
|
1294
|
+
return null;
|
|
1295
|
+
}
|
|
1296
|
+
const componentRef = _viewContainerRef.createComponent(type.component, { injector: _injector });
|
|
1297
|
+
this.componentRefs[type.name] = componentRef;
|
|
1298
|
+
try {
|
|
1299
|
+
componentRef.destroy();
|
|
1300
|
+
}
|
|
1301
|
+
catch (e) {
|
|
1302
|
+
console.error(`An error occurred while destroying the Formly component type "${field.type}"`, e);
|
|
1303
|
+
}
|
|
1309
1304
|
}
|
|
1310
|
-
return type.
|
|
1305
|
+
return this.componentRefs[type.name];
|
|
1306
|
+
}
|
|
1307
|
+
/** @ignore @internal */
|
|
1308
|
+
clearRefs() {
|
|
1309
|
+
this.componentRefs = {};
|
|
1311
1310
|
}
|
|
1312
1311
|
setWrapper(options) {
|
|
1313
1312
|
this.wrappers[options.name] = options;
|
|
@@ -1661,7 +1660,7 @@ class FormlyField {
|
|
|
1661
1660
|
}
|
|
1662
1661
|
const { updateOn, debounce } = field.modelOptions;
|
|
1663
1662
|
if ((!updateOn || updateOn === 'change') && debounce?.default > 0) {
|
|
1664
|
-
valueChanges =
|
|
1663
|
+
valueChanges = valueChanges.pipe(debounceTime(debounce.default));
|
|
1665
1664
|
}
|
|
1666
1665
|
const sub = valueChanges.subscribe((value) => {
|
|
1667
1666
|
// workaround for https://github.com/angular/angular/issues/13792
|
|
@@ -1711,17 +1710,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1711
1710
|
/** @ignore */
|
|
1712
1711
|
class FormlyGroup extends FieldType {
|
|
1713
1712
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyGroup, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1714
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1715
|
-
|
|
1713
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: FormlyGroup, selector: "formly-group", host: { properties: { "class": "field.fieldGroupClassName || \"\"" } }, usesInheritance: true, ngImport: i0, template: `
|
|
1714
|
+
@for (f of field.fieldGroup; track $index) {
|
|
1715
|
+
<formly-field [field]="f"></formly-field>
|
|
1716
|
+
}
|
|
1716
1717
|
<ng-content></ng-content>
|
|
1717
|
-
`, isInline: true, dependencies: [{ kind: "
|
|
1718
|
+
`, isInline: true, dependencies: [{ kind: "component", type: LegacyFormlyField, selector: "formly-field" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1718
1719
|
}
|
|
1719
1720
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyGroup, decorators: [{
|
|
1720
1721
|
type: Component,
|
|
1721
1722
|
args: [{
|
|
1722
1723
|
selector: 'formly-group',
|
|
1723
1724
|
template: `
|
|
1724
|
-
|
|
1725
|
+
@for (f of field.fieldGroup; track $index) {
|
|
1726
|
+
<formly-field [field]="f"></formly-field>
|
|
1727
|
+
}
|
|
1725
1728
|
<ng-content></ng-content>
|
|
1726
1729
|
`,
|
|
1727
1730
|
host: {
|
|
@@ -1765,7 +1768,9 @@ class FormlyFormBuilder {
|
|
|
1765
1768
|
this.injector = injector;
|
|
1766
1769
|
this.viewContainerRef = viewContainerRef;
|
|
1767
1770
|
this.parentForm = parentForm;
|
|
1768
|
-
configs
|
|
1771
|
+
if (configs) {
|
|
1772
|
+
configs.forEach((c) => config.addConfig(c));
|
|
1773
|
+
}
|
|
1769
1774
|
}
|
|
1770
1775
|
buildForm(form, fieldGroup = [], model, options) {
|
|
1771
1776
|
this.build({ fieldGroup, model, form, options });
|
|
@@ -1815,10 +1820,6 @@ class FormlyFormBuilder {
|
|
|
1815
1820
|
defineHiddenProp(options, '_injector', this.injector);
|
|
1816
1821
|
}
|
|
1817
1822
|
if (!options.build) {
|
|
1818
|
-
options._buildForm = () => {
|
|
1819
|
-
console.warn(`Formly: 'options._buildForm' is deprecated since v6.0, use 'options.build' instead.`);
|
|
1820
|
-
this.build(field);
|
|
1821
|
-
};
|
|
1822
1823
|
options.build = (f = field) => {
|
|
1823
1824
|
this.build(f);
|
|
1824
1825
|
return f;
|
|
@@ -1920,6 +1921,7 @@ class FormlyForm {
|
|
|
1920
1921
|
}
|
|
1921
1922
|
ngOnDestroy() {
|
|
1922
1923
|
this.valueChangesUnsubscribe();
|
|
1924
|
+
this.config.clearRefs();
|
|
1923
1925
|
}
|
|
1924
1926
|
checkExpressionChange() {
|
|
1925
1927
|
this.field.options.checkExpressions?.(this.field);
|
|
@@ -2166,12 +2168,13 @@ class FormlyAttributes {
|
|
|
2166
2168
|
this.renderer.removeAttribute(this.elementRef.nativeElement, attr);
|
|
2167
2169
|
}
|
|
2168
2170
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyAttributes, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2169
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: FormlyAttributes, selector: "[formlyAttributes]", inputs: { field: ["formlyAttributes", "field"], id: "id" }, host: { listeners: { "change": "onHostChange($event)" } }, usesOnChanges: true, ngImport: i0 }); }
|
|
2171
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: FormlyAttributes, isStandalone: true, selector: "[formlyAttributes]", inputs: { field: ["formlyAttributes", "field"], id: "id" }, host: { listeners: { "change": "onHostChange($event)" } }, usesOnChanges: true, ngImport: i0 }); }
|
|
2170
2172
|
}
|
|
2171
2173
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyAttributes, decorators: [{
|
|
2172
2174
|
type: Directive,
|
|
2173
2175
|
args: [{
|
|
2174
2176
|
selector: '[formlyAttributes]',
|
|
2177
|
+
standalone: true,
|
|
2175
2178
|
host: {
|
|
2176
2179
|
'(change)': 'onHostChange($event)',
|
|
2177
2180
|
},
|
|
@@ -2185,6 +2188,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2185
2188
|
}], id: [{
|
|
2186
2189
|
type: Input
|
|
2187
2190
|
}] } });
|
|
2191
|
+
class LegacyFormlyAttributes extends FormlyAttributes {
|
|
2192
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LegacyFormlyAttributes, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2193
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: LegacyFormlyAttributes, selector: "[formlyAttributes]", host: { listeners: { "change": "onHostChange($event)" } }, usesInheritance: true, ngImport: i0 }); }
|
|
2194
|
+
}
|
|
2195
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LegacyFormlyAttributes, decorators: [{
|
|
2196
|
+
type: Directive,
|
|
2197
|
+
args: [{
|
|
2198
|
+
selector: '[formlyAttributes]',
|
|
2199
|
+
host: {
|
|
2200
|
+
'(change)': 'onHostChange($event)',
|
|
2201
|
+
},
|
|
2202
|
+
}]
|
|
2203
|
+
}] });
|
|
2188
2204
|
|
|
2189
2205
|
/**
|
|
2190
2206
|
* The `<formly-validation-message>` component renders the error message of a given `field`.
|
|
@@ -2234,7 +2250,7 @@ class FormlyValidationMessage {
|
|
|
2234
2250
|
return undefined;
|
|
2235
2251
|
}
|
|
2236
2252
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyValidationMessage, deps: [{ token: FormlyConfig }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2237
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: FormlyValidationMessage, selector: "formly-validation-message", inputs: { field: "field" }, usesOnChanges: true, ngImport: i0, template: '{{ errorMessage$ | async }}', isInline: true, dependencies: [{ kind: "pipe", type:
|
|
2253
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: FormlyValidationMessage, isStandalone: true, selector: "formly-validation-message", inputs: { field: "field" }, usesOnChanges: true, ngImport: i0, template: '{{ errorMessage$ | async }}', isInline: true, dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2238
2254
|
}
|
|
2239
2255
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyValidationMessage, decorators: [{
|
|
2240
2256
|
type: Component,
|
|
@@ -2242,10 +2258,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2242
2258
|
selector: 'formly-validation-message',
|
|
2243
2259
|
template: '{{ errorMessage$ | async }}',
|
|
2244
2260
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2261
|
+
standalone: true,
|
|
2262
|
+
imports: [AsyncPipe],
|
|
2245
2263
|
}]
|
|
2246
2264
|
}], ctorParameters: () => [{ type: FormlyConfig }], propDecorators: { field: [{
|
|
2247
2265
|
type: Input
|
|
2248
2266
|
}] } });
|
|
2267
|
+
class LegacyFormlyValidationMessage extends FormlyValidationMessage {
|
|
2268
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LegacyFormlyValidationMessage, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2269
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: LegacyFormlyValidationMessage, selector: "formly-validation-message", usesInheritance: true, ngImport: i0, template: '{{ errorMessage$ | async }}', isInline: true, dependencies: [{ kind: "pipe", type: i2$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2270
|
+
}
|
|
2271
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LegacyFormlyValidationMessage, decorators: [{
|
|
2272
|
+
type: Component,
|
|
2273
|
+
args: [{
|
|
2274
|
+
selector: 'formly-validation-message',
|
|
2275
|
+
template: '{{ errorMessage$ | async }}',
|
|
2276
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2277
|
+
}]
|
|
2278
|
+
}] });
|
|
2249
2279
|
|
|
2250
2280
|
class FieldArrayType extends FieldType {
|
|
2251
2281
|
onPopulate(field) {
|
|
@@ -2369,15 +2399,15 @@ class FormlyModule {
|
|
|
2369
2399
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: FormlyModule, declarations: [FormlyTemplate,
|
|
2370
2400
|
LegacyFormlyForm,
|
|
2371
2401
|
LegacyFormlyField,
|
|
2372
|
-
|
|
2402
|
+
LegacyFormlyAttributes,
|
|
2403
|
+
LegacyFormlyValidationMessage,
|
|
2373
2404
|
FormlyGroup,
|
|
2374
|
-
FormlyValidationMessage,
|
|
2375
2405
|
FormlyTemplateType], imports: [CommonModule], exports: [FormlyTemplate,
|
|
2376
2406
|
LegacyFormlyForm,
|
|
2377
2407
|
LegacyFormlyField,
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2408
|
+
LegacyFormlyAttributes,
|
|
2409
|
+
LegacyFormlyValidationMessage,
|
|
2410
|
+
FormlyGroup] }); }
|
|
2381
2411
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyModule, imports: [CommonModule] }); }
|
|
2382
2412
|
}
|
|
2383
2413
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyModule, decorators: [{
|
|
@@ -2387,18 +2417,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2387
2417
|
FormlyTemplate,
|
|
2388
2418
|
LegacyFormlyForm,
|
|
2389
2419
|
LegacyFormlyField,
|
|
2390
|
-
|
|
2420
|
+
LegacyFormlyAttributes,
|
|
2421
|
+
LegacyFormlyValidationMessage,
|
|
2391
2422
|
FormlyGroup,
|
|
2392
|
-
FormlyValidationMessage,
|
|
2393
2423
|
FormlyTemplateType,
|
|
2394
2424
|
],
|
|
2395
2425
|
exports: [
|
|
2396
2426
|
FormlyTemplate,
|
|
2397
2427
|
LegacyFormlyForm,
|
|
2398
2428
|
LegacyFormlyField,
|
|
2399
|
-
|
|
2429
|
+
LegacyFormlyAttributes,
|
|
2430
|
+
LegacyFormlyValidationMessage,
|
|
2400
2431
|
FormlyGroup,
|
|
2401
|
-
FormlyValidationMessage,
|
|
2402
2432
|
],
|
|
2403
2433
|
imports: [CommonModule],
|
|
2404
2434
|
}]
|
|
@@ -2412,5 +2442,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2412
2442
|
* Generated bundle index. Do not edit.
|
|
2413
2443
|
*/
|
|
2414
2444
|
|
|
2415
|
-
export { FORMLY_CONFIG, FieldArrayType, FieldType, FieldWrapper, FormlyConfig, FormlyField, FormlyForm, FormlyFormBuilder, FormlyModule, LegacyFormlyField, LegacyFormlyForm, provideFormlyConfig, provideFormlyCore,
|
|
2445
|
+
export { FORMLY_CONFIG, FieldArrayType, FieldType, FieldWrapper, FormlyAttributes, FormlyConfig, FormlyField, FormlyForm, FormlyFormBuilder, FormlyModule, FormlyValidationMessage, LegacyFormlyAttributes, LegacyFormlyField, LegacyFormlyForm, LegacyFormlyValidationMessage, provideFormlyConfig, provideFormlyCore, FormlyGroup as ɵFormlyGroup, FormlyTemplate as ɵFormlyTemplate, clone as ɵclone, defineHiddenProp as ɵdefineHiddenProp, getFieldValue as ɵgetFieldValue, hasKey as ɵhasKey, observe as ɵobserve, reverseDeepMerge as ɵreverseDeepMerge };
|
|
2416
2446
|
//# sourceMappingURL=ngx-formly-core.mjs.map
|