@suntelecoms/ngx-dynamic-form 1.1.3 → 1.2.3

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.
@@ -1,4 +1,4 @@
1
- import type { DynamicFormConfig, DynamicFormField, FieldType, FieldValidation, SelectOption } from '../../models/form-field.model';
1
+ import type { DynamicFormConfig, DynamicFormField, FieldType, FieldValidation, SelectOption, StepperFormConfig } from '../../models/form-field.model';
2
2
  import * as i0 from "@angular/core";
3
3
  interface FieldTypeDef {
4
4
  type: FieldType;
@@ -6,22 +6,32 @@ interface FieldTypeDef {
6
6
  icon: string;
7
7
  group: 'Saisie' | 'Choix' | 'Mise en page';
8
8
  }
9
+ interface BuilderStep {
10
+ label: string;
11
+ icon?: string;
12
+ fields: DynamicFormField[];
13
+ }
9
14
  export declare const ICON_OPTIONS: {
10
15
  value: string;
11
16
  label: string;
12
17
  }[];
13
18
  export declare class FormBuilderComponent {
14
- /** Route du lien "Retour" dans la topbar */
15
19
  backRoute: string;
16
20
  private formService;
17
21
  private snack;
18
- fields: import("@angular/core").WritableSignal<DynamicFormField[]>;
22
+ isStepperMode: import("@angular/core").WritableSignal<boolean>;
23
+ private flatFields;
24
+ steps: import("@angular/core").WritableSignal<BuilderStep[]>;
25
+ selectedStepIdx: import("@angular/core").WritableSignal<number>;
26
+ renamingStepIdx: import("@angular/core").WritableSignal<number | null>;
27
+ renamingLabel: import("@angular/core").WritableSignal<string>;
19
28
  selectedIdx: import("@angular/core").WritableSignal<number | null>;
20
29
  activeTab: import("@angular/core").WritableSignal<"schema" | "preview">;
21
30
  formTitle: import("@angular/core").WritableSignal<string>;
22
31
  submitLabel: import("@angular/core").WritableSignal<string>;
23
32
  resetLabel: import("@angular/core").WritableSignal<string>;
24
33
  showReset: import("@angular/core").WritableSignal<boolean>;
34
+ stepperShowSummary: import("@angular/core").WritableSignal<boolean>;
25
35
  currentId: import("@angular/core").WritableSignal<string | null>;
26
36
  showExport: import("@angular/core").WritableSignal<boolean>;
27
37
  exportContent: import("@angular/core").WritableSignal<string>;
@@ -33,12 +43,16 @@ export declare class FormBuilderComponent {
33
43
  value: string;
34
44
  label: string;
35
45
  }[];
36
- selectedField: import("@angular/core").Signal<DynamicFormField | null>;
37
- previewConfig: import("@angular/core").Signal<DynamicFormConfig>;
38
- groupedTypes: import("@angular/core").Signal<{
46
+ readonly fields: import("@angular/core").Signal<DynamicFormField[]>;
47
+ readonly selectedField: import("@angular/core").Signal<DynamicFormField | null>;
48
+ readonly previewConfig: import("@angular/core").Signal<DynamicFormConfig>;
49
+ readonly stepperPreviewConfig: import("@angular/core").Signal<StepperFormConfig>;
50
+ readonly groupedTypes: import("@angular/core").Signal<{
39
51
  label: "Saisie" | "Choix" | "Mise en page";
40
52
  types: FieldTypeDef[];
41
53
  }[]>;
54
+ readonly stepperIsEmpty: import("@angular/core").Signal<boolean>;
55
+ private mutateFields;
42
56
  getIcon(type: string): string;
43
57
  getFieldDisplay(field: DynamicFormField): string;
44
58
  isInputField(type: FieldType): boolean;
@@ -58,6 +72,13 @@ export declare class FormBuilderComponent {
58
72
  addOption(): void;
59
73
  updateOption(idx: number, prop: 'label' | 'value', value: string): void;
60
74
  removeOption(idx: number): void;
75
+ setMode(stepper: boolean): void;
76
+ selectStep(i: number): void;
77
+ addStep(): void;
78
+ deleteStep(i: number, e: Event): void;
79
+ startRename(i: number, e: Event): void;
80
+ confirmRename(i: number): void;
81
+ cancelRename(): void;
61
82
  save(): void;
62
83
  loadSchema(id: string): void;
63
84
  deleteSchema(id: string, e: Event): void;
@@ -66,7 +87,6 @@ export declare class FormBuilderComponent {
66
87
  exportTypeScript(): void;
67
88
  copyExport(): Promise<void>;
68
89
  copyFormUrl(): void;
69
- validationOf(key: keyof FieldValidation): any;
70
90
  labelOf(type: FieldType): string;
71
91
  trackByKey(_i: number, field: DynamicFormField): string;
72
92
  trackByIdx(i: number): number;
@@ -1,5 +1,6 @@
1
1
  import { OnInit } from '@angular/core';
2
- import type { DynamicFormConfig, DynamicFormSubmitEvent } from '../../models/form-field.model';
2
+ import type { DynamicFormConfig, StepperFormConfig, DynamicFormSubmitEvent } from '../../models/form-field.model';
3
+ import type { AnyFormConfig } from '../../models/saved-form.model';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare class FormLoaderComponent implements OnInit {
5
6
  /** Passé directement si le composant est utilisé sans ActivatedRoute */
@@ -10,7 +11,9 @@ export declare class FormLoaderComponent implements OnInit {
10
11
  builderRoute: string;
11
12
  private route;
12
13
  private formService;
13
- config: import("@angular/core").WritableSignal<DynamicFormConfig | null>;
14
+ config: import("@angular/core").WritableSignal<AnyFormConfig | null>;
15
+ flatConfig: import("@angular/core").Signal<DynamicFormConfig | null>;
16
+ stepperConfig: import("@angular/core").Signal<StepperFormConfig | null>;
14
17
  formTitle: import("@angular/core").WritableSignal<string>;
15
18
  schemaId: import("@angular/core").WritableSignal<string>;
16
19
  submitted: import("@angular/core").WritableSignal<boolean>;
@@ -1,5 +1,5 @@
1
- import type { DynamicFormConfig, DynamicFormSubmitEvent } from '../../models/form-field.model';
2
- import type { SavedFormSchema } from '../../models/saved-form.model';
1
+ import type { DynamicFormConfig, StepperFormConfig, DynamicFormSubmitEvent } from '../../models/form-field.model';
2
+ import type { AnyFormConfig, SavedFormSchema } from '../../models/saved-form.model';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class MesFormulairesComponent {
5
5
  /** Route vers le builder (lien "Nouveau formulaire" et actions d'édition) */
@@ -13,14 +13,16 @@ export declare class MesFormulairesComponent {
13
13
  selectedId: import("@angular/core").WritableSignal<string | null>;
14
14
  submitted: import("@angular/core").WritableSignal<boolean>;
15
15
  submitData: import("@angular/core").WritableSignal<Record<string, unknown>>;
16
- activeConfig: import("@angular/core").Signal<DynamicFormConfig | null>;
16
+ activeConfig: import("@angular/core").Signal<AnyFormConfig | null>;
17
+ activeFlatConfig: import("@angular/core").Signal<DynamicFormConfig | null>;
18
+ activeStepperConfig: import("@angular/core").Signal<StepperFormConfig | null>;
17
19
  activeSchema: import("@angular/core").Signal<SavedFormSchema | null>;
18
20
  selectForm(id: string): void;
19
21
  onSubmit(event: DynamicFormSubmitEvent): void;
20
22
  resetForm(): void;
21
23
  deleteForm(id: string, e: Event): void;
22
24
  formatDate(iso: string): string;
23
- fieldCount(config: DynamicFormConfig): number;
25
+ fieldCount(config: AnyFormConfig): number;
24
26
  static ɵfac: i0.ɵɵFactoryDeclaration<MesFormulairesComponent, never>;
25
27
  static ɵcmp: i0.ɵɵComponentDeclaration<MesFormulairesComponent, "ngx-mes-formulaires", never, { "builderRoute": { "alias": "builderRoute"; "required": false; }; "formRoute": { "alias": "formRoute"; "required": false; }; "backRoute": { "alias": "backRoute"; "required": false; }; }, {}, never, never, true, never>;
26
28
  }
@@ -0,0 +1,45 @@
1
+ import { EventEmitter, OnInit, OnChanges, SimpleChanges, ChangeDetectorRef } from '@angular/core';
2
+ import { FormGroup } from '@angular/forms';
3
+ import { MatStepper } from '@angular/material/stepper';
4
+ import { StepperFormConfig, DynamicFormSubmitEvent, DynamicFormField } from '../../models/form-field.model';
5
+ import { DynamicFormBuilderService } from '../../services/dynamic-form-builder.service';
6
+ import { ConditionEvaluatorService } from '../../services/condition-evaluator.service';
7
+ import * as i0 from "@angular/core";
8
+ interface SummaryItem {
9
+ label: string;
10
+ value: string;
11
+ }
12
+ interface SummarySection {
13
+ stepLabel: string;
14
+ stepIndex: number;
15
+ items: SummaryItem[];
16
+ }
17
+ export declare class StepperFormComponent implements OnInit, OnChanges {
18
+ private builder;
19
+ private conditionEvaluator;
20
+ private cdr;
21
+ config: StepperFormConfig;
22
+ initialValues?: Record<string, any>;
23
+ formSubmit: EventEmitter<DynamicFormSubmitEvent>;
24
+ formChange: EventEmitter<Record<string, any>>;
25
+ stepChange: EventEmitter<number>;
26
+ stepper: MatStepper;
27
+ stepForms: FormGroup[];
28
+ constructor(builder: DynamicFormBuilderService, conditionEvaluator: ConditionEvaluatorService, cdr: ChangeDetectorRef);
29
+ ngOnInit(): void;
30
+ ngOnChanges(changes: SimpleChanges): void;
31
+ private buildForms;
32
+ isVisible(field: DynamicFormField, form: FormGroup): boolean;
33
+ nextStep(i: number): void;
34
+ goToStep(i: number): void;
35
+ onSubmit(): void;
36
+ onReset(): void;
37
+ getSummary(): SummarySection[];
38
+ formatValue(field: DynamicFormField, value: any): string;
39
+ getStepForm(stepIdx: number): FormGroup;
40
+ getAllValues(): Record<string, any>;
41
+ private getAllRawValues;
42
+ static ɵfac: i0.ɵɵFactoryDeclaration<StepperFormComponent, never>;
43
+ static ɵcmp: i0.ɵɵComponentDeclaration<StepperFormComponent, "ngx-stepper-form", never, { "config": { "alias": "config"; "required": true; }; "initialValues": { "alias": "initialValues"; "required": false; }; }, { "formSubmit": "formSubmit"; "formChange": "formChange"; "stepChange": "stepChange"; }, never, never, true, never>;
44
+ }
45
+ export {};
@@ -62,6 +62,24 @@ export interface DynamicFormConfig {
62
62
  cssClass?: string;
63
63
  debug?: boolean;
64
64
  }
65
+ export interface FormStep {
66
+ label: string;
67
+ icon?: string;
68
+ description?: string;
69
+ fields: DynamicFormField[];
70
+ }
71
+ export interface StepperFormConfig {
72
+ steps: FormStep[];
73
+ submitLabel?: string;
74
+ showReset?: boolean;
75
+ resetLabel?: string;
76
+ linear?: boolean;
77
+ orientation?: 'horizontal' | 'vertical';
78
+ showSummary?: boolean;
79
+ summaryLabel?: string;
80
+ cssClass?: string;
81
+ debug?: boolean;
82
+ }
65
83
  export interface DynamicFormSubmitEvent {
66
84
  value: Record<string, any>;
67
85
  rawValue: Record<string, any>;
@@ -1,7 +1,8 @@
1
- import type { DynamicFormConfig } from './form-field.model';
1
+ import type { DynamicFormConfig, StepperFormConfig } from './form-field.model';
2
+ export type AnyFormConfig = DynamicFormConfig | StepperFormConfig;
2
3
  export interface SavedFormSchema {
3
4
  id: string;
4
5
  title: string;
5
- config: DynamicFormConfig;
6
+ config: AnyFormConfig;
6
7
  updatedAt: string;
7
8
  }
@@ -1,6 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import type { SavedFormSchema } from '../models/saved-form.model';
3
- import type { DynamicFormConfig } from '../models/form-field.model';
3
+ import type { AnyFormConfig } from '../models/saved-form.model';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class FormConfigService {
6
6
  private adapter;
@@ -8,7 +8,7 @@ export declare class FormConfigService {
8
8
  readonly schemas: import("@angular/core").Signal<SavedFormSchema[]>;
9
9
  constructor();
10
10
  get(id: string): SavedFormSchema | null;
11
- save(id: string, title: string, config: DynamicFormConfig): Observable<SavedFormSchema>;
11
+ save(id: string, title: string, config: AnyFormConfig): Observable<SavedFormSchema>;
12
12
  delete(id: string): Observable<void>;
13
13
  generateId(): string;
14
14
  static ɵfac: i0.ɵɵFactoryDeclaration<FormConfigService, never>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suntelecoms/ngx-dynamic-form",
3
- "version": "1.1.3",
3
+ "version": "1.2.3",
4
4
  "description": "Générateur de formulaires Angular dynamiques — SUNTELECOMS",
5
5
  "author": "Amadou Diallo <amadoumacbookpro38@gmail.com>",
6
6
  "license": "MIT",
package/public-api.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { DynamicFormComponent } from './lib/components/dynamic-form/dynamic-form.component';
2
2
  export { DynamicFieldComponent } from './lib/components/dynamic-field/dynamic-field.component';
3
+ export { StepperFormComponent } from './lib/components/stepper-form/stepper-form.component';
3
4
  export { FormBuilderComponent } from './lib/components/form-builder/form-builder.component';
4
5
  export { MesFormulairesComponent } from './lib/components/mes-formulaires/mes-formulaires.component';
5
6
  export { FormLoaderComponent } from './lib/components/form-loader/form-loader.component';
@@ -11,5 +12,5 @@ export { LocalStorageAdapter } from './lib/storage/local-storage.adapter';
11
12
  export { HttpStorageAdapter, FORM_API_URL } from './lib/storage/http-storage.adapter';
12
13
  export { provideNgxForms } from './lib/providers';
13
14
  export type { NgxFormsOptions, NgxFormsLocalOptions, NgxFormsHttpOptions } from './lib/providers';
14
- export type { DynamicFormField, DynamicFormConfig, DynamicFormSubmitEvent, FieldType, FieldValidation, FieldCondition, SelectOption, } from './lib/models/form-field.model';
15
- export type { SavedFormSchema } from './lib/models/saved-form.model';
15
+ export type { DynamicFormField, DynamicFormConfig, StepperFormConfig, FormStep, DynamicFormSubmitEvent, FieldType, FieldValidation, FieldCondition, SelectOption, } from './lib/models/form-field.model';
16
+ export type { SavedFormSchema, AnyFormConfig } from './lib/models/saved-form.model';