@suntelecoms/ngx-dynamic-form 1.7.16 → 1.7.19
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 +51 -5
- package/fesm2022/suntelecoms-ngx-dynamic-form.mjs +147 -44
- package/fesm2022/suntelecoms-ngx-dynamic-form.mjs.map +1 -1
- package/lib/components/dynamic-field/dynamic-field.component.d.ts +9 -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
|
@@ -105,14 +105,21 @@ export declare class DynamicFieldComponent implements OnInit {
|
|
|
105
105
|
get hasOptions(): boolean;
|
|
106
106
|
get hasError(): boolean;
|
|
107
107
|
get errorMessage(): string | null;
|
|
108
|
-
/**
|
|
108
|
+
/** Bornes du mat-datepicker [min]/[max] : la plus stricte entre field.minDate/maxDate
|
|
109
|
+
* ('today' ou ISO 'YYYY-MM-DD') et la valeur courante du champ validation.minField/maxField
|
|
110
|
+
* — une période début/fin grise ainsi les dates invalides dans le calendrier. */
|
|
109
111
|
get minDate(): Date | undefined;
|
|
110
112
|
get maxDate(): Date | undefined;
|
|
111
113
|
/** Same bound, as 'YYYY-MM-DD' for the native <input type="date"> min/max attributes (simple appearance). */
|
|
112
114
|
get minDateAttr(): string | undefined;
|
|
113
115
|
get maxDateAttr(): string | undefined;
|
|
114
116
|
private resolveFieldDate;
|
|
115
|
-
|
|
117
|
+
/** type 'date', apparence simple : bloque la saisie (Tab reste libre), Entrée/Espace ouvrent le sélecteur. */
|
|
118
|
+
onNativeDateKeydown(e: KeyboardEvent): void;
|
|
119
|
+
openNativeDatePicker(e: Event): void;
|
|
120
|
+
/** Valeur courante d'un autre champ date du formulaire (Date du datepicker ou chaîne ISO). */
|
|
121
|
+
private siblingDate;
|
|
122
|
+
private stricterDate;
|
|
116
123
|
private setupRequiredWhen;
|
|
117
124
|
private updateRequiredFromConditions;
|
|
118
125
|
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