@suntelecoms/ngx-dynamic-form 1.2.6 → 1.2.9
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 +211 -138
- package/fesm2022/suntelecoms-ngx-dynamic-form.mjs +852 -158
- package/fesm2022/suntelecoms-ngx-dynamic-form.mjs.map +1 -1
- package/lib/components/dynamic-field/dynamic-field.component.d.ts +21 -1
- package/lib/components/form-builder/form-builder.component.d.ts +15 -0
- package/lib/components/form-loader/form-loader.component.d.ts +3 -3
- package/lib/models/form-field.model.d.ts +23 -1
- package/lib/models/saved-form.model.d.ts +2 -0
- package/lib/services/form-config.service.d.ts +4 -3
- package/lib/storage/form-storage.adapter.d.ts +3 -1
- package/lib/storage/http-storage.adapter.d.ts +3 -1
- package/lib/storage/local-storage.adapter.d.ts +3 -1
- package/package.json +1 -1
|
@@ -5,19 +5,39 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
export declare class DynamicFieldComponent implements OnInit {
|
|
6
6
|
field: DynamicFormField;
|
|
7
7
|
form: FormGroup;
|
|
8
|
+
/** Apparence héritée du formulaire parent — surchargeable par field.appearance */
|
|
9
|
+
formAppearance: 'outline' | 'fill' | 'simple';
|
|
10
|
+
/** Comportement du label hérité du parent — surchargeable par field.floatLabel */
|
|
11
|
+
formFloatLabel: 'auto' | 'always';
|
|
12
|
+
get resolvedAppearance(): 'outline' | 'fill' | 'simple';
|
|
13
|
+
/** Apparence passée à mat-form-field : 'simple' est géré côté template, ne jamais le passer à Material */
|
|
14
|
+
get matAppearance(): 'outline' | 'fill';
|
|
15
|
+
get isSimple(): boolean;
|
|
16
|
+
get resolvedFloatLabel(): 'auto' | 'always';
|
|
8
17
|
private builder;
|
|
9
18
|
private http;
|
|
10
19
|
private dataApiUrl;
|
|
11
20
|
resolvedOptions: SelectOption[];
|
|
12
21
|
loadingOptions: boolean;
|
|
22
|
+
locating: boolean;
|
|
23
|
+
locationError: string;
|
|
24
|
+
getLocation(): void;
|
|
25
|
+
private _geoError;
|
|
26
|
+
get hostStyle(): Record<string, string>;
|
|
27
|
+
get hostClass(): string;
|
|
13
28
|
ngOnInit(): void;
|
|
14
29
|
private resolveStaticOptions;
|
|
15
30
|
private loadRemoteOptions;
|
|
16
31
|
get formControl(): FormControl;
|
|
32
|
+
/**
|
|
33
|
+
* Masque de saisie : # = chiffre, tout autre caractère = séparateur littéral.
|
|
34
|
+
* Ex : '## ## ## ## ##' → téléphone, '##/##/####' → date.
|
|
35
|
+
*/
|
|
36
|
+
applyMask(event: Event): void;
|
|
17
37
|
get isInputField(): boolean;
|
|
18
38
|
get hasOptions(): boolean;
|
|
19
39
|
get hasError(): boolean;
|
|
20
40
|
get errorMessage(): string | null;
|
|
21
41
|
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicFieldComponent, never>;
|
|
22
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFieldComponent, "ngx-dynamic-field", never, { "field": { "alias": "field"; "required": true; }; "form": { "alias": "form"; "required": true; }; }, {}, never, never, true, never>;
|
|
42
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFieldComponent, "ngx-dynamic-field", never, { "field": { "alias": "field"; "required": true; }; "form": { "alias": "form"; "required": true; }; "formAppearance": { "alias": "formAppearance"; "required": false; }; "formFloatLabel": { "alias": "formFloatLabel"; "required": false; }; }, {}, never, never, true, never>;
|
|
23
43
|
}
|
|
@@ -32,6 +32,9 @@ export declare class FormBuilderComponent {
|
|
|
32
32
|
resetLabel: import("@angular/core").WritableSignal<string>;
|
|
33
33
|
showReset: import("@angular/core").WritableSignal<boolean>;
|
|
34
34
|
stepperShowSummary: import("@angular/core").WritableSignal<boolean>;
|
|
35
|
+
formAppearance: import("@angular/core").WritableSignal<"outline" | "fill" | "simple">;
|
|
36
|
+
formFloatLabel: import("@angular/core").WritableSignal<"auto" | "always">;
|
|
37
|
+
formCode: import("@angular/core").WritableSignal<string>;
|
|
35
38
|
currentId: import("@angular/core").WritableSignal<string | null>;
|
|
36
39
|
showExport: import("@angular/core").WritableSignal<boolean>;
|
|
37
40
|
exportContent: import("@angular/core").WritableSignal<string>;
|
|
@@ -74,6 +77,18 @@ export declare class FormBuilderComponent {
|
|
|
74
77
|
removeOption(idx: number): void;
|
|
75
78
|
setOptionsSource(useUrl: boolean): void;
|
|
76
79
|
private deleteProp;
|
|
80
|
+
/** Presets de masques de saisie courants */
|
|
81
|
+
readonly maskPresets: {
|
|
82
|
+
label: string;
|
|
83
|
+
value: string;
|
|
84
|
+
}[];
|
|
85
|
+
isCustomMask(): boolean;
|
|
86
|
+
setMaskPreset(value: string): void;
|
|
87
|
+
getMaskPresetValue(): string;
|
|
88
|
+
/** Convertit le Record<string,string> en texte CSS pour l'éditeur */
|
|
89
|
+
getStylesText(): string;
|
|
90
|
+
/** Parse le texte CSS et met à jour la propriété styles */
|
|
91
|
+
setStylesText(cssText: string): void;
|
|
77
92
|
setMode(stepper: boolean): void;
|
|
78
93
|
selectStep(i: number): void;
|
|
79
94
|
addStep(): void;
|
|
@@ -4,7 +4,7 @@ import type { AnyFormConfig } from '../../models/saved-form.model';
|
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export declare class FormLoaderComponent implements OnInit {
|
|
6
6
|
/** Passé directement si le composant est utilisé sans ActivatedRoute */
|
|
7
|
-
|
|
7
|
+
formCode?: string;
|
|
8
8
|
/** Route du lien "Retour" */
|
|
9
9
|
backRoute: string;
|
|
10
10
|
/** Route vers le builder */
|
|
@@ -15,7 +15,7 @@ export declare class FormLoaderComponent implements OnInit {
|
|
|
15
15
|
flatConfig: import("@angular/core").Signal<DynamicFormConfig | null>;
|
|
16
16
|
stepperConfig: import("@angular/core").Signal<StepperFormConfig | null>;
|
|
17
17
|
formTitle: import("@angular/core").WritableSignal<string>;
|
|
18
|
-
|
|
18
|
+
schemaCode: import("@angular/core").WritableSignal<string>;
|
|
19
19
|
submitted: import("@angular/core").WritableSignal<boolean>;
|
|
20
20
|
submitData: import("@angular/core").WritableSignal<Record<string, unknown>>;
|
|
21
21
|
notFound: import("@angular/core").WritableSignal<boolean>;
|
|
@@ -23,5 +23,5 @@ export declare class FormLoaderComponent implements OnInit {
|
|
|
23
23
|
onSubmit(event: DynamicFormSubmitEvent): void;
|
|
24
24
|
reset(): void;
|
|
25
25
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormLoaderComponent, never>;
|
|
26
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<FormLoaderComponent, "ngx-form-loader", never, { "
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FormLoaderComponent, "ngx-form-loader", never, { "formCode": { "alias": "formCode"; "required": false; }; "backRoute": { "alias": "backRoute"; "required": false; }; "builderRoute": { "alias": "builderRoute"; "required": false; }; }, {}, never, never, true, never>;
|
|
27
27
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type FieldType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'textarea' | 'select' | 'multiselect' | 'checkbox' | 'radio' | 'date' | 'datetime-local' | 'file' | 'hidden' | 'divider' | 'heading';
|
|
1
|
+
export type FieldType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'textarea' | 'select' | 'multiselect' | 'checkbox' | 'radio' | 'switch' | 'date' | 'datetime-local' | 'time' | 'month' | 'week' | 'range' | 'color' | 'location' | 'file' | 'hidden' | 'divider' | 'heading';
|
|
2
2
|
export interface SelectOption {
|
|
3
3
|
label: string;
|
|
4
4
|
value: any;
|
|
@@ -50,10 +50,28 @@ export interface DynamicFormField {
|
|
|
50
50
|
accept?: string;
|
|
51
51
|
multiple?: boolean;
|
|
52
52
|
rows?: number;
|
|
53
|
+
min?: number;
|
|
54
|
+
max?: number;
|
|
55
|
+
step?: number;
|
|
56
|
+
showValue?: boolean;
|
|
53
57
|
text?: string;
|
|
54
58
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
55
59
|
icon?: string;
|
|
56
60
|
iconSuffix?: string;
|
|
61
|
+
appearance?: 'outline' | 'fill' | 'simple';
|
|
62
|
+
floatLabel?: 'auto' | 'always';
|
|
63
|
+
prefix?: string;
|
|
64
|
+
suffix?: string;
|
|
65
|
+
mask?: string;
|
|
66
|
+
fontSize?: string;
|
|
67
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
68
|
+
color?: string;
|
|
69
|
+
backgroundColor?: string;
|
|
70
|
+
borderColor?: string;
|
|
71
|
+
labelColor?: string;
|
|
72
|
+
fontWeight?: 'normal' | 'bold';
|
|
73
|
+
fontStyle?: 'normal' | 'italic';
|
|
74
|
+
styles?: Record<string, string>;
|
|
57
75
|
attrs?: Record<string, any>;
|
|
58
76
|
}
|
|
59
77
|
export interface DynamicFormConfig {
|
|
@@ -64,6 +82,8 @@ export interface DynamicFormConfig {
|
|
|
64
82
|
layout?: 'vertical' | 'horizontal' | 'inline';
|
|
65
83
|
cssClass?: string;
|
|
66
84
|
debug?: boolean;
|
|
85
|
+
appearance?: 'outline' | 'fill' | 'simple';
|
|
86
|
+
floatLabel?: 'auto' | 'always';
|
|
67
87
|
}
|
|
68
88
|
export interface FormStep {
|
|
69
89
|
label: string;
|
|
@@ -82,6 +102,8 @@ export interface StepperFormConfig {
|
|
|
82
102
|
summaryLabel?: string;
|
|
83
103
|
cssClass?: string;
|
|
84
104
|
debug?: boolean;
|
|
105
|
+
appearance?: 'outline' | 'fill' | 'simple';
|
|
106
|
+
floatLabel?: 'auto' | 'always';
|
|
85
107
|
}
|
|
86
108
|
export interface DynamicFormSubmitEvent {
|
|
87
109
|
value: Record<string, any>;
|
|
@@ -2,7 +2,9 @@ import type { DynamicFormConfig, StepperFormConfig } from './form-field.model';
|
|
|
2
2
|
export type AnyFormConfig = DynamicFormConfig | StepperFormConfig;
|
|
3
3
|
export interface SavedFormSchema {
|
|
4
4
|
id: string;
|
|
5
|
+
code: string;
|
|
5
6
|
title: string;
|
|
6
7
|
config: AnyFormConfig;
|
|
8
|
+
createdAt: string;
|
|
7
9
|
updatedAt: string;
|
|
8
10
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import type { SavedFormSchema } from '../models/saved-form.model';
|
|
3
|
-
import type { AnyFormConfig } from '../models/saved-form.model';
|
|
2
|
+
import type { SavedFormSchema, AnyFormConfig } from '../models/saved-form.model';
|
|
4
3
|
import * as i0 from "@angular/core";
|
|
5
4
|
export declare class FormConfigService {
|
|
6
5
|
private adapter;
|
|
@@ -8,7 +7,9 @@ export declare class FormConfigService {
|
|
|
8
7
|
readonly schemas: import("@angular/core").Signal<SavedFormSchema[]>;
|
|
9
8
|
constructor();
|
|
10
9
|
get(id: string): SavedFormSchema | null;
|
|
11
|
-
|
|
10
|
+
getByCode(code: string): SavedFormSchema | null;
|
|
11
|
+
create(code: string, title: string, config: AnyFormConfig): Observable<SavedFormSchema>;
|
|
12
|
+
update(schema: SavedFormSchema, title: string, config: AnyFormConfig): Observable<SavedFormSchema>;
|
|
12
13
|
delete(id: string): Observable<void>;
|
|
13
14
|
generateId(): string;
|
|
14
15
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormConfigService, never>;
|
|
@@ -3,7 +3,9 @@ import type { SavedFormSchema } from '../models/saved-form.model';
|
|
|
3
3
|
export declare abstract class FormStorageAdapter {
|
|
4
4
|
abstract list(): Observable<SavedFormSchema[]>;
|
|
5
5
|
abstract get(id: string): Observable<SavedFormSchema | null>;
|
|
6
|
-
abstract
|
|
6
|
+
abstract getByCode(code: string): Observable<SavedFormSchema | null>;
|
|
7
|
+
abstract create(schema: Omit<SavedFormSchema, 'id'>): Observable<SavedFormSchema>;
|
|
8
|
+
abstract update(schema: SavedFormSchema): Observable<SavedFormSchema>;
|
|
7
9
|
abstract delete(id: string): Observable<void>;
|
|
8
10
|
generateId(): string;
|
|
9
11
|
}
|
|
@@ -9,7 +9,9 @@ export declare class HttpStorageAdapter extends FormStorageAdapter {
|
|
|
9
9
|
private apiUrl;
|
|
10
10
|
list(): Observable<SavedFormSchema[]>;
|
|
11
11
|
get(id: string): Observable<SavedFormSchema | null>;
|
|
12
|
-
|
|
12
|
+
getByCode(code: string): Observable<SavedFormSchema | null>;
|
|
13
|
+
create(schema: Omit<SavedFormSchema, 'id'>): Observable<SavedFormSchema>;
|
|
14
|
+
update(schema: SavedFormSchema): Observable<SavedFormSchema>;
|
|
13
15
|
delete(id: string): Observable<void>;
|
|
14
16
|
static ɵfac: i0.ɵɵFactoryDeclaration<HttpStorageAdapter, never>;
|
|
15
17
|
static ɵprov: i0.ɵɵInjectableDeclaration<HttpStorageAdapter>;
|
|
@@ -5,7 +5,9 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
export declare class LocalStorageAdapter extends FormStorageAdapter {
|
|
6
6
|
list(): Observable<SavedFormSchema[]>;
|
|
7
7
|
get(id: string): Observable<SavedFormSchema | null>;
|
|
8
|
-
|
|
8
|
+
getByCode(code: string): Observable<SavedFormSchema | null>;
|
|
9
|
+
create(schema: Omit<SavedFormSchema, 'id'>): Observable<SavedFormSchema>;
|
|
10
|
+
update(schema: SavedFormSchema): Observable<SavedFormSchema>;
|
|
9
11
|
delete(id: string): Observable<void>;
|
|
10
12
|
private _read;
|
|
11
13
|
private _write;
|
package/package.json
CHANGED