@suntelecoms/ngx-dynamic-form 1.7.16 → 1.7.20
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 +60 -7
- package/fesm2022/suntelecoms-ngx-dynamic-form.mjs +189 -46
- package/fesm2022/suntelecoms-ngx-dynamic-form.mjs.map +1 -1
- package/lib/components/dynamic-field/dynamic-field.component.d.ts +19 -2
- package/lib/models/form-field.model.d.ts +2 -0
- package/lib/services/dynamic-form-builder.service.d.ts +1 -0
- package/lib/utils/field-compare.d.ts +9 -0
- package/lib/utils/option-label.d.ts +12 -0
- package/package.json +1 -1
|
@@ -62,12 +62,22 @@ export declare class DynamicFieldComponent implements OnInit {
|
|
|
62
62
|
phoneSearch: string;
|
|
63
63
|
/** Chiffres locaux courants (hors indicatif), tenus à jour par `applyPhoneMask` — évite de les re-dériver de la valeur E.164 complète du formControl (qui contient déjà l'ancien indicatif). */
|
|
64
64
|
private phoneLocalDigits;
|
|
65
|
+
/** Texte affiché dans la saisie (chiffres locaux masqués). Suit aussi la valeur posée de
|
|
66
|
+
* l'extérieur (initialValues en mode édition, patchValue) — sans lui, la saisie restait vide. */
|
|
67
|
+
phoneDisplay: string;
|
|
65
68
|
get filteredPhoneCountries(): PhoneCountry[];
|
|
66
69
|
selectPhoneCountry(country: PhoneCountry): void;
|
|
67
70
|
getLocation(): void;
|
|
68
71
|
private _geoError;
|
|
69
72
|
onPhoneSelectChange(event: Event): void;
|
|
70
73
|
applyPhoneMask(event: Event): void;
|
|
74
|
+
private maskPhone;
|
|
75
|
+
/**
|
|
76
|
+
* Répercute une valeur du formControl sur le pays et la saisie affichée : '+222 22 12 34 56'
|
|
77
|
+
* ou '0022222123456' -> Mauritanie + '22 12 34 56' ; un numéro sans indicatif ('774127793')
|
|
78
|
+
* garde le pays courant. Ignore les valeurs produites par la saisie elle-même.
|
|
79
|
+
*/
|
|
80
|
+
private syncPhoneFromValue;
|
|
71
81
|
get hostStyle(): Record<string, string>;
|
|
72
82
|
get hostClass(): string;
|
|
73
83
|
ngOnInit(): void;
|
|
@@ -105,14 +115,21 @@ export declare class DynamicFieldComponent implements OnInit {
|
|
|
105
115
|
get hasOptions(): boolean;
|
|
106
116
|
get hasError(): boolean;
|
|
107
117
|
get errorMessage(): string | null;
|
|
108
|
-
/**
|
|
118
|
+
/** Bornes du mat-datepicker [min]/[max] : la plus stricte entre field.minDate/maxDate
|
|
119
|
+
* ('today' ou ISO 'YYYY-MM-DD') et la valeur courante du champ validation.minField/maxField
|
|
120
|
+
* — une période début/fin grise ainsi les dates invalides dans le calendrier. */
|
|
109
121
|
get minDate(): Date | undefined;
|
|
110
122
|
get maxDate(): Date | undefined;
|
|
111
123
|
/** Same bound, as 'YYYY-MM-DD' for the native <input type="date"> min/max attributes (simple appearance). */
|
|
112
124
|
get minDateAttr(): string | undefined;
|
|
113
125
|
get maxDateAttr(): string | undefined;
|
|
114
126
|
private resolveFieldDate;
|
|
115
|
-
|
|
127
|
+
/** type 'date', apparence simple : bloque la saisie (Tab reste libre), Entrée/Espace ouvrent le sélecteur. */
|
|
128
|
+
onNativeDateKeydown(e: KeyboardEvent): void;
|
|
129
|
+
openNativeDatePicker(e: Event): void;
|
|
130
|
+
/** Valeur courante d'un autre champ date du formulaire (Date du datepicker ou chaîne ISO). */
|
|
131
|
+
private siblingDate;
|
|
132
|
+
private stricterDate;
|
|
116
133
|
private setupRequiredWhen;
|
|
117
134
|
private updateRequiredFromConditions;
|
|
118
135
|
onLookupBlur(): void;
|
|
@@ -87,6 +87,8 @@ export interface DynamicFormField {
|
|
|
87
87
|
hidden?: boolean;
|
|
88
88
|
options?: SelectOption[] | string;
|
|
89
89
|
url?: string;
|
|
90
|
+
/** Label des options API : clé ('codeClient'), chemin pointé ('personnePhysique.nom')
|
|
91
|
+
* ou modèle de concaténation ('{{codeClient}} - {{telephone}}'). Défaut : 'label'. */
|
|
90
92
|
displayName?: string;
|
|
91
93
|
displayValue?: string;
|
|
92
94
|
responseDataKey?: string;
|
|
@@ -13,6 +13,7 @@ export declare class DynamicFormBuilderService {
|
|
|
13
13
|
* Cross-field bound validator: sets an error on `fieldKey` when:
|
|
14
14
|
* mode 'max': field value > other field value
|
|
15
15
|
* mode 'min': field value < other field value
|
|
16
|
+
* Numbers and dates (Date from mat-datepicker or ISO string) — see compareFieldValues.
|
|
16
17
|
*
|
|
17
18
|
* Error is set directly on the FormControl so the existing per-field
|
|
18
19
|
* error display in DynamicFieldComponent picks it up automatically.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Date → 'YYYY-MM-DD' en heure locale (toISOString passe en UTC et peut décaler d'un jour). */
|
|
2
|
+
export declare function toIsoDate(d: Date): string;
|
|
3
|
+
/**
|
|
4
|
+
* Compare deux valeurs de champ pour maxField/minField : < 0, 0, > 0, ou null si non comparables
|
|
5
|
+
* (valeur vide, types différents). Les chaînes ISO des champs date, datetime-local, month, week
|
|
6
|
+
* et time se trient en ordre lexicographique, sans conversion de fuseau horaire. Elles sont
|
|
7
|
+
* comparées sur leur longueur commune : '2026-01-01' vs '2026-01-01T10:00:00Z' → même jour → 0.
|
|
8
|
+
*/
|
|
9
|
+
export declare function compareFieldValues(a: unknown, b: unknown): number | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Lit une valeur via un chemin pointé : getPath(item, 'personnePhysique.nom'). */
|
|
2
|
+
export declare function getPath(obj: any, path: string): any;
|
|
3
|
+
/**
|
|
4
|
+
* Libellé d'une option chargée depuis une API. `displayName` accepte :
|
|
5
|
+
* - une clé ou un chemin pointé : 'codeClient', 'personnePhysique.nom'
|
|
6
|
+
* - un modèle de concaténation : '{{codeClient}} - {{telephone}}',
|
|
7
|
+
* '{{personnePhysique.nom}} {{personnePhysique.prenom}}'
|
|
8
|
+
* Dans un modèle, une valeur absente (null/undefined) est remplacée par '' et
|
|
9
|
+
* les espaces en trop sont réduits — on peut donc enchaîner des alternatives :
|
|
10
|
+
* '{{personnePhysique.nom}} {{personnePhysique.prenom}}{{personneMorale.raisonSociale}}'.
|
|
11
|
+
*/
|
|
12
|
+
export declare function optionLabel(item: any, displayName: string): string;
|
package/package.json
CHANGED