@suntelecoms/ngx-dynamic-form 1.2.6 → 1.2.8
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 +94 -10
- package/fesm2022/suntelecoms-ngx-dynamic-form.mjs +779 -128
- 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 +14 -0
- package/lib/models/form-field.model.d.ts +23 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://angular.dev)
|
|
6
6
|
[](https://material.angular.io)
|
|
7
|
-
[](CHANGELOG.md)
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
[](mailto:amadoumacbookpro38@gmail.com)
|
|
10
10
|
|
|
@@ -58,7 +58,15 @@ Résultat : dans n'importe quel projet Angular, il suffit de **2 lignes** pour a
|
|
|
58
58
|
|
|
59
59
|
## Fonctionnalités
|
|
60
60
|
|
|
61
|
-
- **
|
|
61
|
+
- **24 types de champs** — `text`, `email`, `password`, `number`, `tel`, `url`, `date`, `datetime-local`, `time`, `month`, `week`, `textarea`, `select`, `multiselect`, `radio`, `checkbox`, `switch`, `range`, `color`, `location`, `file`, `hidden`, `divider`, `heading`
|
|
62
|
+
- **3 variantes d'apparence** — `outline`, `fill`, `simple` (label fixe au-dessus) — globale ou par champ _(v1.2.7)_
|
|
63
|
+
- **Datepicker Material** (`mat-datepicker`) pour le type `date` _(v1.2.8)_
|
|
64
|
+
- **Géolocalisation** — type `location` avec bouton GPS et API `navigator.geolocation` _(v1.2.8)_
|
|
65
|
+
- **Curseur de valeur** — type `range` rendu en `mat-slider` _(v1.2.8)_
|
|
66
|
+
- **Interrupteur** — type `switch` rendu en `mat-slide-toggle` _(v1.2.8)_
|
|
67
|
+
- **Styling par champ** — `fontSize`, `textAlign`, `color`, `backgroundColor`, `borderColor`, `labelColor`, `fontWeight`, `fontStyle`, `cssClass`, `styles` _(v1.2.7)_
|
|
68
|
+
- **Masque de saisie** — propriété `mask` (`#` = chiffre, autres chars = séparateurs) _(v1.2.7)_
|
|
69
|
+
- **Préfixe / suffixe texte** — propriétés `prefix` et `suffix` _(v1.2.7)_
|
|
62
70
|
- **Floating label** Angular Material (`mat-form-field appearance="outline"`)
|
|
63
71
|
- **Validation déclarative** — `required`, `email`, `minLength`, `maxLength`, `min`, `max`, `pattern`, validateur personnalisé
|
|
64
72
|
- **Messages d'erreur personnalisés** par champ
|
|
@@ -204,24 +212,54 @@ Pour disposer du **Form Builder + gestionnaire + rendu par URL** dans votre appl
|
|
|
204
212
|
|
|
205
213
|
## Types de champs
|
|
206
214
|
|
|
215
|
+
### Saisie texte
|
|
216
|
+
|
|
207
217
|
| Type | Rendu | Description |
|
|
208
218
|
|---|---|---|
|
|
209
219
|
| `text` | `<input type="text">` | Champ texte standard |
|
|
210
220
|
| `email` | `<input type="email">` | Validation e-mail intégrée |
|
|
211
221
|
| `password` | `<input type="password">` | Mot de passe masqué |
|
|
212
222
|
| `number` | `<input type="number">` | Supporte `min`, `max` |
|
|
213
|
-
| `tel` | `<input type="tel">` | Téléphone |
|
|
223
|
+
| `tel` | `<input type="tel">` | Téléphone — compatible masque de saisie |
|
|
214
224
|
| `url` | `<input type="url">` | URL |
|
|
215
|
-
| `
|
|
216
|
-
|
|
217
|
-
|
|
225
|
+
| `textarea` | `<textarea>` | Zone de texte multi-lignes, propriété `rows` |
|
|
226
|
+
|
|
227
|
+
### Date & Heure
|
|
228
|
+
|
|
229
|
+
| Type | Rendu | Description |
|
|
230
|
+
|---|---|---|
|
|
231
|
+
| `date` | `mat-datepicker` | Calendrier Material — popup avec sélection mois/année _(v1.2.8)_ |
|
|
232
|
+
| `datetime-local` | `<input type="datetime-local">` | Date et heure combinées |
|
|
233
|
+
| `time` | `<input type="time">` | Heure (HH:mm) |
|
|
234
|
+
| `month` | `<input type="month">` | Mois et année |
|
|
235
|
+
| `week` | `<input type="week">` | Semaine ISO |
|
|
236
|
+
|
|
237
|
+
### Choix
|
|
238
|
+
|
|
239
|
+
| Type | Rendu | Description |
|
|
240
|
+
|---|---|---|
|
|
241
|
+
| `select` | `<mat-select>` | Liste déroulante — 1 choix — options statiques ou API |
|
|
218
242
|
| `multiselect` | `<mat-select multiple>` | Liste déroulante — plusieurs choix |
|
|
219
|
-
| `radio` | `<mat-radio-group>` | Boutons radio |
|
|
243
|
+
| `radio` | `<mat-radio-group>` | Boutons radio — options statiques ou API |
|
|
220
244
|
| `checkbox` | `<mat-checkbox>` | Case à cocher booléenne |
|
|
221
|
-
| `
|
|
245
|
+
| `switch` | `<mat-slide-toggle>` | Interrupteur on/off _(v1.2.8)_ |
|
|
246
|
+
|
|
247
|
+
### Spéciaux
|
|
248
|
+
|
|
249
|
+
| Type | Rendu | Description |
|
|
250
|
+
|---|---|---|
|
|
251
|
+
| `range` | `<mat-slider>` | Curseur de valeur — propriétés `min`, `max`, `step`, `showValue` _(v1.2.8)_ |
|
|
252
|
+
| `color` | `<input type="color">` | Sélecteur de couleur avec affichage du code hex _(v1.2.8)_ |
|
|
253
|
+
| `location` | `<input>` + bouton GPS | Champ adresse avec géolocalisation — bouton `my_location` déclenche `navigator.geolocation` _(v1.2.8)_ |
|
|
254
|
+
| `file` | `<input type="file">` | Téléversement — propriétés `accept`, `multiple` |
|
|
255
|
+
|
|
256
|
+
### Mise en page
|
|
257
|
+
|
|
258
|
+
| Type | Rendu | Description |
|
|
259
|
+
|---|---|---|
|
|
222
260
|
| `hidden` | `<input type="hidden">` | Champ caché (présent dans le FormGroup) |
|
|
223
261
|
| `divider` | `<hr>` | Séparateur horizontal |
|
|
224
|
-
| `heading` | `<h1>` à `<h6>` | Titre de section |
|
|
262
|
+
| `heading` | `<h1>` à `<h6>` | Titre de section — propriétés `text`, `level` |
|
|
225
263
|
|
|
226
264
|
---
|
|
227
265
|
|
|
@@ -236,6 +274,9 @@ interface DynamicFormConfig {
|
|
|
236
274
|
layout?: 'vertical' | 'horizontal' | 'inline';
|
|
237
275
|
cssClass?: string;
|
|
238
276
|
debug?: boolean; // Affiche les valeurs JSON en temps réel
|
|
277
|
+
// Apparence globale ← v1.2.7
|
|
278
|
+
appearance?: 'outline' | 'fill' | 'simple'; // défaut : 'outline'
|
|
279
|
+
floatLabel?: 'auto' | 'always'; // défaut : 'auto'
|
|
239
280
|
}
|
|
240
281
|
```
|
|
241
282
|
|
|
@@ -255,6 +296,8 @@ interface DynamicFormField {
|
|
|
255
296
|
hint?: string;
|
|
256
297
|
icon?: string; // Icône préfixe (Material Icons)
|
|
257
298
|
iconSuffix?: string; // Icône suffixe (Material Icons)
|
|
299
|
+
prefix?: string; // Texte préfixe dans le champ (ex : '+221') ← v1.2.7
|
|
300
|
+
suffix?: string; // Texte suffixe dans le champ (ex : 'FCFA') ← v1.2.7
|
|
258
301
|
|
|
259
302
|
// Valeur & état
|
|
260
303
|
defaultValue?: any;
|
|
@@ -275,7 +318,7 @@ interface DynamicFormField {
|
|
|
275
318
|
|
|
276
319
|
// Disposition
|
|
277
320
|
col?: 1|2|3|4|6|8|9|12; // Colonnes sur 12 (défaut : 12)
|
|
278
|
-
cssClass?: string;
|
|
321
|
+
cssClass?: string; // Classe CSS ajoutée sur l'hôte ← v1.2.7
|
|
279
322
|
|
|
280
323
|
// Affichage conditionnel
|
|
281
324
|
showWhen?: FieldCondition | FieldCondition[];
|
|
@@ -291,6 +334,32 @@ interface DynamicFormField {
|
|
|
291
334
|
text?: string;
|
|
292
335
|
level?: 1|2|3|4|5|6; // Défaut : 2
|
|
293
336
|
|
|
337
|
+
// Spécifique range ← v1.2.8
|
|
338
|
+
min?: number; // Valeur minimale du curseur (défaut : 0)
|
|
339
|
+
max?: number; // Valeur maximale du curseur (défaut : 100)
|
|
340
|
+
step?: number; // Pas du curseur (défaut : 1)
|
|
341
|
+
showValue?: boolean; // Afficher la valeur courante à côté du curseur
|
|
342
|
+
|
|
343
|
+
// Masque de saisie ← v1.2.7
|
|
344
|
+
// '#' = chiffre obligatoire, tout autre caractère = séparateur littéral
|
|
345
|
+
// Ex : '## ### ## ##' → téléphone SN, '##/##/####' → date, '#### #### #### ####' → CB
|
|
346
|
+
mask?: string;
|
|
347
|
+
|
|
348
|
+
// Apparence individuelle (override la valeur globale du formulaire) ← v1.2.7
|
|
349
|
+
appearance?: 'outline' | 'fill' | 'simple';
|
|
350
|
+
floatLabel?: 'auto' | 'always';
|
|
351
|
+
|
|
352
|
+
// Style & Apparence ← v1.2.7 / v1.2.8
|
|
353
|
+
fontSize?: string; // Ex : '14px', '1.1rem'
|
|
354
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
355
|
+
color?: string; // Couleur du texte saisi
|
|
356
|
+
backgroundColor?: string; // Couleur de fond du champ
|
|
357
|
+
borderColor?: string; // Couleur de la bordure ← v1.2.8
|
|
358
|
+
labelColor?: string; // Couleur du label ← v1.2.8
|
|
359
|
+
fontWeight?: 'normal' | 'bold';
|
|
360
|
+
fontStyle?: 'normal' | 'italic';
|
|
361
|
+
styles?: Record<string, string>; // Styles CSS inline supplémentaires
|
|
362
|
+
|
|
294
363
|
attrs?: Record<string, any>;
|
|
295
364
|
}
|
|
296
365
|
```
|
|
@@ -1333,6 +1402,21 @@ export type { SelectOption }
|
|
|
1333
1402
|
|
|
1334
1403
|
## Changelog
|
|
1335
1404
|
|
|
1405
|
+
### v1.2.8
|
|
1406
|
+
- **6 nouveaux types de champs** : `switch` (`mat-slide-toggle`), `range` (`mat-slider`), `color` (color picker + affichage hex), `location` (géolocalisation GPS), `time`, `month`, `week`, `datetime-local` accessibles depuis le Builder
|
|
1407
|
+
- **Datepicker Material** : le type `date` utilise désormais `mat-datepicker` (calendrier popup Material) en mode outline/fill — conversion string → Date automatique pour les valeurs préremplies
|
|
1408
|
+
- **Géolocalisation** : le type `location` embarque un bouton GPS (`my_location`) qui déclenche `navigator.geolocation.getCurrentPosition()` et remplit le champ avec `"lat,lng"` — gestion des erreurs (refus, timeout, position indisponible)
|
|
1409
|
+
- **Curseur range** : min, max, step configurables depuis le Builder — affichage de la valeur courante en temps réel
|
|
1410
|
+
- **Couleurs bordure et label** : nouvelles propriétés `borderColor` et `labelColor` sur `DynamicFormField` — appliquées via CSS custom properties, ciblent les composants Material (MDC) via `:host[style*="..."]` pour ne pas écraser les champs sans couleur définie
|
|
1411
|
+
|
|
1412
|
+
### v1.2.7
|
|
1413
|
+
- **Apparence `simple`** : 3ème variante d'apparence — label fixe au-dessus, input borduré avec `border-radius: 8px` et focus ring — sans `mat-form-field` (rendu HTML natif). Disponible globalement (`DynamicFormConfig.appearance`) ou par champ (`DynamicFormField.appearance`)
|
|
1414
|
+
- **Masque de saisie** : propriété `mask` sur les champs texte — `#` = chiffre, autres chars = séparateurs littéraux. Présets prêts à l'emploi dans le Builder (téléphone SN, international, date, heure, CB, code postal, personnalisé)
|
|
1415
|
+
- **Préfixe / suffixe texte** : propriétés `prefix` et `suffix` — affichés à l'intérieur du champ (différents des icônes)
|
|
1416
|
+
- **Styling complet par champ** : `fontSize`, `textAlign`, `color`, `backgroundColor`, `fontWeight`, `fontStyle`, `cssClass`, `styles` (CSS inline arbitraire) — appliqués via `@HostBinding('style')` et CSS custom properties
|
|
1417
|
+
- **Apparence globale configurable** : `DynamicFormConfig.appearance` et `.floatLabel` (+ idem pour `StepperFormConfig`) — le Builder expose ces réglages dans le panneau "Paramètres du formulaire" avec prévisualisation des 3 variantes (outline / fill / simple)
|
|
1418
|
+
- **Panel Style & Apparence dans le Builder** : section dédiée pour tous les réglages visuels d'un champ (couleurs, taille, alignement, gras, italique, bordure, label)
|
|
1419
|
+
|
|
1336
1420
|
### v1.2.6
|
|
1337
1421
|
- Fix : en mode édition, les champs `select`/`multiselect`/`radio` avec `url` reçoivent maintenant correctement leur valeur initiale même si l'API retourne un objet imbriqué (ex. `ville: { id: 9, nom: "Dakar" }` → extrait automatiquement `id` via `displayValue`)
|
|
1338
1422
|
- Fix appliqué aussi dans `StepperFormComponent` pour les formulaires multi-étapes
|