@stemy/ngx-dynamic-form 19.9.13 → 19.9.15

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.
@@ -254,8 +254,9 @@ export interface FormFieldType<T = FormFieldProps> extends FormFieldConfig<T> {
254
254
  }
255
255
  export interface FormFieldChangeEvent {
256
256
  field: FormFieldConfig;
257
- type: string;
257
+ type: "expressionChanges" | "valueChanges" | string;
258
258
  value: any;
259
+ form?: IDynamicForm;
259
260
  [meta: string]: any;
260
261
  }
261
262
  export interface FormSerializeResult {
@@ -279,6 +280,7 @@ export interface IDynamicForm {
279
280
  readonly onSubmit: OutputRef<IDynamicForm>;
280
281
  readonly onFieldChanges: OutputRef<FormFieldChangeEvent>;
281
282
  readonly onValueChanges: OutputRef<FormFieldChangeEvent>;
283
+ readonly onExpressionChanges: OutputRef<FormFieldChangeEvent>;
282
284
  readonly onInit: OutputRef<FormFieldChangeEvent>;
283
285
  reset(): void;
284
286
  serialize(validate?: boolean, ...purposes: string[]): Promise<FormSerializeResult>;
@@ -330,6 +332,11 @@ export type FormFieldData = Pick<FormFieldProps, "label" | "labelAlign" | "descr
330
332
  * This is a custom serializer callback function. (Can't be defined from JSON schema because it is a JS callback)
331
333
  */
332
334
  serializer?: FormFieldSerializer;
335
+ /**
336
+ * Use `defaultValue` to initialize it the model.
337
+ * If this is provided and the value of the model at compile-time is undefined, then the value of the model will be assigned to `defaultValue`.
338
+ */
339
+ defaultValue?: any;
333
340
  /**
334
341
  * Puts the field in a custom field set
335
342
  */
@@ -1,5 +1,4 @@
1
1
  import { AbstractControl, FormGroup } from "@angular/forms";
2
- import { Subject } from "rxjs";
3
2
  import { FormlyFormOptions } from "@ngx-formly/core";
4
3
  import { EventsService } from "@stemy/ngx-utils";
5
4
  import { FormFieldChangeEvent, FormFieldConfig, FormFieldLabelCustomizer, FormSerializeResult, IDynamicForm } from "../../common-types";
@@ -21,9 +20,11 @@ export declare class DynamicFormComponent implements IDynamicForm {
21
20
  readonly legacyLabels: import("@angular/core").InputSignal<boolean>;
22
21
  readonly data: import("@angular/core").InputSignal<any>;
23
22
  readonly fields: import("@angular/core").InputSignal<FormFieldConfig<import("../../common-types").FormFieldProps> | FormFieldConfig<import("../../common-types").FormFieldProps>[]>;
24
- readonly fieldChanges: Subject<FormFieldChangeEvent>;
23
+ readonly options: FormlyFormOptions;
24
+ readonly fieldChanges: import("rxjs").Observable<FormFieldChangeEvent>;
25
25
  readonly init: import("rxjs").Observable<FormFieldChangeEvent>;
26
26
  readonly valueChanges: import("rxjs").Observable<FormFieldChangeEvent>;
27
+ readonly expressionChanges: import("rxjs").Observable<FormFieldChangeEvent>;
27
28
  protected readonly language: import("@angular/core").Signal<string>;
28
29
  protected readonly enableTranslations: import("@angular/core").Signal<boolean>;
29
30
  readonly config: import("@angular/core").Signal<FormFieldConfig<import("../../common-types").FormFieldProps>[]>;
@@ -33,8 +34,8 @@ export declare class DynamicFormComponent implements IDynamicForm {
33
34
  readonly onSubmit: import("@angular/core").OutputEmitterRef<IDynamicForm>;
34
35
  readonly onFieldChanges: import("@angular/core").OutputRef<FormFieldChangeEvent>;
35
36
  readonly onValueChanges: import("@angular/core").OutputRef<FormFieldChangeEvent>;
37
+ readonly onExpressionChanges: import("@angular/core").OutputRef<FormFieldChangeEvent>;
36
38
  readonly onInit: import("@angular/core").OutputRef<FormFieldChangeEvent>;
37
- readonly options: FormlyFormOptions;
38
39
  constructor(forms: DynamicFormService, templates: DynamicFormTemplateService);
39
40
  submit(): void;
40
41
  reset(): void;
@@ -42,5 +43,5 @@ export declare class DynamicFormComponent implements IDynamicForm {
42
43
  getField(path: string): FormFieldConfig;
43
44
  getControl(path: string): AbstractControl;
44
45
  static ɵfac: i0.ɵɵFactoryDeclaration<DynamicFormComponent, never>;
45
- static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFormComponent, "dynamic-form", never, { "globalTemplatePrefix": { "alias": "globalTemplatePrefix"; "required": false; "isSignal": true; }; "labelPrefix": { "alias": "labelPrefix"; "required": false; "isSignal": true; }; "labelCustomizer": { "alias": "labelCustomizer"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; "useTabs": { "alias": "useTabs"; "required": false; "isSignal": true; }; "legacyLabels": { "alias": "legacyLabels"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "fields": { "alias": "fields"; "required": false; "isSignal": true; }; }, { "onSubmit": "onSubmit"; "onFieldChanges": "onFieldChanges"; "onValueChanges": "onValueChanges"; "onInit": "onInit"; }, never, ["*"], false, never>;
46
+ static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFormComponent, "dynamic-form", never, { "globalTemplatePrefix": { "alias": "globalTemplatePrefix"; "required": false; "isSignal": true; }; "labelPrefix": { "alias": "labelPrefix"; "required": false; "isSignal": true; }; "labelCustomizer": { "alias": "labelCustomizer"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; "useTabs": { "alias": "useTabs"; "required": false; "isSignal": true; }; "legacyLabels": { "alias": "legacyLabels"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "fields": { "alias": "fields"; "required": false; "isSignal": true; }; }, { "onSubmit": "onSubmit"; "onFieldChanges": "onFieldChanges"; "onValueChanges": "onValueChanges"; "onExpressionChanges": "onExpressionChanges"; "onInit": "onInit"; }, never, ["*"], false, never>;
46
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stemy/ngx-dynamic-form",
3
- "version": "19.9.13",
3
+ "version": "19.9.15",
4
4
  "license": "MIT",
5
5
  "public": true,
6
6
  "repository": "https://github.com/stemyke/ngx-dynamic-form.git",