@ngx-formly/core 7.0.0 → 7.1.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.
Files changed (32) hide show
  1. package/README.md +12 -12
  2. package/esm2022/json-schema/formly-json-schema.service.mjs +102 -2
  3. package/esm2022/lib/components/formly.form.mjs +10 -4
  4. package/esm2022/lib/components/formly.template.mjs +11 -3
  5. package/esm2022/lib/core.config.mjs +35 -5
  6. package/esm2022/lib/core.mjs +3 -3
  7. package/esm2022/lib/core.module.mjs +9 -9
  8. package/esm2022/lib/extensions/field-expression/field-expression.mjs +6 -244
  9. package/esm2022/lib/extensions/field-expression/utils.mjs +453 -11
  10. package/esm2022/lib/extensions/field-expression-legacy/field-expression.mjs +249 -0
  11. package/esm2022/lib/extensions/field-expression-legacy/utils.mjs +20 -0
  12. package/esm2022/lib/utils.mjs +2 -1
  13. package/esm2022/preset/preset-substitution.extension.mjs +2 -2
  14. package/fesm2022/ngx-formly-core-json-schema.mjs +101 -1
  15. package/fesm2022/ngx-formly-core-json-schema.mjs.map +1 -1
  16. package/fesm2022/ngx-formly-core-preset.mjs +1 -1
  17. package/fesm2022/ngx-formly-core-preset.mjs.map +1 -1
  18. package/fesm2022/ngx-formly-core.mjs +532 -17
  19. package/fesm2022/ngx-formly-core.mjs.map +1 -1
  20. package/json-schema/formly-json-schema.service.d.ts +3 -0
  21. package/lib/components/formly.form.d.ts +3 -2
  22. package/lib/components/formly.template.d.ts +5 -1
  23. package/lib/core.config.d.ts +1 -0
  24. package/lib/core.d.ts +3 -3
  25. package/lib/core.module.d.ts +1 -1
  26. package/lib/extensions/field-expression/field-expression.d.ts +3 -12
  27. package/lib/extensions/field-expression/utils.d.ts +4 -2
  28. package/lib/extensions/field-expression-legacy/field-expression.d.ts +16 -0
  29. package/lib/extensions/field-expression-legacy/utils.d.ts +5 -0
  30. package/package.json +1 -1
  31. package/esm2022/lib/extensions/index.mjs +0 -2
  32. package/lib/extensions/index.d.ts +0 -1
@@ -17,6 +17,9 @@ export declare class FormlyJsonschema {
17
17
  private resolveMultiSchema;
18
18
  private resolveDefinition;
19
19
  private resolveDependencies;
20
+ private extractIfCondition;
21
+ private resolveIfThenElse;
22
+ private resolveConditionalSchema;
20
23
  private guessSchemaType;
21
24
  private addValidator;
22
25
  private isEnum;
@@ -14,7 +14,7 @@ export declare class FormlyForm implements DoCheck, OnChanges, OnDestroy {
14
14
  private builder;
15
15
  private config;
16
16
  private ngZone;
17
- private fieldTemplates;
17
+ protected fieldTemplates: FormlyFieldTemplates;
18
18
  /** The form instance which allow to track model value and validation status. */
19
19
  set form(form: UntypedFormGroup | UntypedFormArray);
20
20
  get form(): UntypedFormGroup | UntypedFormArray;
@@ -44,6 +44,7 @@ export declare class FormlyForm implements DoCheck, OnChanges, OnDestroy {
44
44
  static ɵcmp: i0.ɵɵComponentDeclaration<FormlyForm, "formly-form", never, { "form": { "alias": "form"; "required": false; }; "model": { "alias": "model"; "required": false; }; "fields": { "alias": "fields"; "required": false; }; "options": { "alias": "options"; "required": false; }; }, { "modelChange": "modelChange"; }, ["templates"], never, true, never>;
45
45
  }
46
46
  export declare class LegacyFormlyForm extends FormlyForm {
47
+ set templates(templates: QueryList<FormlyTemplate>);
47
48
  static ɵfac: i0.ɵɵFactoryDeclaration<LegacyFormlyForm, never>;
48
- static ɵcmp: i0.ɵɵComponentDeclaration<LegacyFormlyForm, "formly-form", never, {}, {}, never, never, false, never>;
49
+ static ɵcmp: i0.ɵɵComponentDeclaration<LegacyFormlyForm, "formly-form", never, {}, {}, ["templates"], never, false, never>;
49
50
  }
@@ -6,7 +6,11 @@ export declare class FormlyTemplate implements OnChanges {
6
6
  constructor(ref: TemplateRef<any>);
7
7
  ngOnChanges(): void;
8
8
  static ɵfac: i0.ɵɵFactoryDeclaration<FormlyTemplate, never>;
9
- static ɵdir: i0.ɵɵDirectiveDeclaration<FormlyTemplate, "[formlyTemplate]", never, { "name": { "alias": "formlyTemplate"; "required": false; }; }, {}, never, never, false, never>;
9
+ static ɵdir: i0.ɵɵDirectiveDeclaration<FormlyTemplate, "[formlyTemplate]", never, { "name": { "alias": "formlyTemplate"; "required": false; }; }, {}, never, never, true, never>;
10
+ }
11
+ export declare class LegacyFormlyTemplate extends FormlyTemplate {
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<LegacyFormlyTemplate, never>;
13
+ static ɵdir: i0.ɵɵDirectiveDeclaration<LegacyFormlyTemplate, "[formlyTemplate]", never, {}, {}, never, never, false, never>;
10
14
  }
11
15
  export declare class FormlyFieldTemplates {
12
16
  templates: QueryList<FormlyTemplate>;
@@ -6,5 +6,6 @@ import { FormlyConfig } from './services/formly.config';
6
6
  */
7
7
  export declare const FORMLY_CONFIG: InjectionToken<ConfigOption[]>;
8
8
  export declare function withDefaultConfig(config: FormlyConfig): ConfigOption;
9
+ export declare function withFormlyFieldExpression(): ConfigOption;
9
10
  export declare const provideFormlyCore: (configs?: ConfigOption | ConfigOption[]) => Provider;
10
11
  export declare const provideFormlyConfig: (configs?: ConfigOption | ConfigOption[]) => Provider;
package/lib/core.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { provideFormlyCore, provideFormlyConfig, FORMLY_CONFIG } from './core.config';
1
+ export { provideFormlyCore, provideFormlyConfig, FORMLY_CONFIG, withFormlyFieldExpression } from './core.config';
2
2
  export { LegacyFormlyForm, FormlyForm } from './components/formly.form';
3
- export { FormlyFieldConfig, FormlyTemplateOptions, FormlyFormOptions, FormlyFieldProps, ConfigOption, FormlyExtension, } from './models';
3
+ export { FormlyFieldConfig, FormlyTemplateOptions, FormlyFormOptions, FormlyFieldProps, ConfigOption, FormlyExtension, FormlyFieldConfigPresetProvider, } from './models';
4
4
  export { LegacyFormlyField, FormlyField } from './components/formly.field';
5
5
  export { LegacyFormlyAttributes, FormlyAttributes } from './templates/formly.attributes';
6
6
  export { FormlyGroup as ɵFormlyGroup } from './templates/formly.group';
7
- export { FormlyTemplate as ɵFormlyTemplate } from './components/formly.template';
7
+ export { FormlyTemplate, LegacyFormlyTemplate as ɵFormlyTemplate } from './components/formly.template';
8
8
  export { LegacyFormlyValidationMessage, FormlyValidationMessage } from './templates/formly.validation-message';
9
9
  export { FormlyConfig } from './services/formly.config';
10
10
  export { FormlyFormBuilder } from './services/formly.builder';
@@ -13,6 +13,6 @@ export declare class FormlyModule {
13
13
  static forRoot(config?: ConfigOption): ModuleWithProviders<FormlyModule>;
14
14
  static forChild(config?: ConfigOption): ModuleWithProviders<FormlyModule>;
15
15
  static ɵfac: i0.ɵɵFactoryDeclaration<FormlyModule, never>;
16
- static ɵmod: i0.ɵɵNgModuleDeclaration<FormlyModule, [typeof i1.FormlyTemplate, typeof i2.LegacyFormlyForm, typeof i3.LegacyFormlyField, typeof i4.LegacyFormlyAttributes, typeof i5.LegacyFormlyValidationMessage, typeof i6.FormlyGroup, typeof i7.FormlyTemplateType], [typeof i8.CommonModule], [typeof i1.FormlyTemplate, typeof i2.LegacyFormlyForm, typeof i3.LegacyFormlyField, typeof i4.LegacyFormlyAttributes, typeof i5.LegacyFormlyValidationMessage, typeof i6.FormlyGroup]>;
16
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FormlyModule, [typeof i1.LegacyFormlyTemplate, typeof i2.LegacyFormlyForm, typeof i3.LegacyFormlyField, typeof i4.LegacyFormlyAttributes, typeof i5.LegacyFormlyValidationMessage, typeof i6.FormlyGroup, typeof i7.FormlyTemplateType], [typeof i8.CommonModule], [typeof i1.LegacyFormlyTemplate, typeof i2.LegacyFormlyForm, typeof i3.LegacyFormlyField, typeof i4.LegacyFormlyAttributes, typeof i5.LegacyFormlyValidationMessage, typeof i6.FormlyGroup]>;
17
17
  static ɵinj: i0.ɵɵInjectorDeclaration<FormlyModule>;
18
18
  }
@@ -1,13 +1,4 @@
1
- import { FormlyFieldConfigCache } from '../../models';
2
- import { FormlyExtension } from '../../models';
3
- export declare class FieldExpressionExtension implements FormlyExtension {
4
- onPopulate(field: FormlyFieldConfigCache): void;
5
- postPopulate(field: FormlyFieldConfigCache): void;
6
- private parseExpressions;
7
- private checkExpressions;
8
- private changeDisabledState;
9
- private changeHideState;
10
- private evalExpr;
11
- private emitExpressionChanges;
12
- private _evalExpressionPath;
1
+ import { FieldExpressionExtension as FieldExpressionLegacyExtension } from '../field-expression-legacy/field-expression';
2
+ export declare class FieldExpressionExtension extends FieldExpressionLegacyExtension {
3
+ protected _evalStringExpression(expression: string, argNames: string[]): any;
13
4
  }
@@ -1,2 +1,4 @@
1
- export declare function evalStringExpression(expression: string, argNames: string[]): any;
2
- export declare function evalExpression(expression: string | ((...value: any[]) => any) | boolean, thisArg: any, argVal: any[]): any;
1
+ /**
2
+ * Uses CSP-safe implementation
3
+ */
4
+ export declare function parseExpression(expression: string, argNames: string[]): any;
@@ -0,0 +1,16 @@
1
+ import { FormlyFieldConfigCache } from '../../models';
2
+ import { FormlyExtension } from '../../models';
3
+ export declare class FieldExpressionExtension implements FormlyExtension {
4
+ onPopulate(field: FormlyFieldConfigCache): void;
5
+ postPopulate(field: FormlyFieldConfigCache): void;
6
+ protected parseExpressions(field: FormlyFieldConfigCache, path: string, expr: any): {
7
+ callback: (ignoreCache?: boolean) => boolean;
8
+ };
9
+ protected _evalStringExpression(expression: string, argNames: string[]): any;
10
+ private checkExpressions;
11
+ private changeDisabledState;
12
+ private changeHideState;
13
+ private evalExpr;
14
+ private emitExpressionChanges;
15
+ private _evalExpressionPath;
16
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Legacy implementation
3
+ */
4
+ export declare function evalStringExpressionLegacy(expression: string, argNames: string[]): any;
5
+ export declare function evalExpression(expression: string | ((...value: any[]) => any) | boolean, thisArg: any, argVal: any[]): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngx-formly/core",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
6
  "tslib": "^2.0.0"
@@ -1,2 +0,0 @@
1
- export { FieldExpressionExtension } from './field-expression/field-expression';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvY29yZS9zcmMvbGliL2V4dGVuc2lvbnMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLHdCQUF3QixFQUFFLE1BQU0scUNBQXFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBGaWVsZEV4cHJlc3Npb25FeHRlbnNpb24gfSBmcm9tICcuL2ZpZWxkLWV4cHJlc3Npb24vZmllbGQtZXhwcmVzc2lvbic7XG4iXX0=
@@ -1 +0,0 @@
1
- export { FieldExpressionExtension } from './field-expression/field-expression';