chrv-components 1.11.0 → 1.11.2
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 +346 -13
- package/chrv-components-1.11.2.tgz +0 -0
- package/fesm2022/chrv-components.mjs +46 -46
- package/fesm2022/chrv-components.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +10 -11
- package/src/lib/styles/_colors-classes.css +111 -0
- package/src/lib/styles/_colors-selectors.css +79 -0
- package/src/lib/styles/colors.css +2 -0
- package/src/lib/styles/corners.css +251 -0
- package/src/lib/styles/h.css +17 -0
- package/src/lib/styles/hollow-font.css +35 -0
- package/src/lib/styles/links.css +41 -0
- package/src/lib/styles/trapeze.css +57 -0
- package/chrv-components-1.11.0.tgz +0 -0
package/README.md
CHANGED
|
@@ -1,25 +1,358 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🎨 CHRV Components
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<div align="center">
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
**Bibliothèque complète de composants Angular avec Tailwind CSS**
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
[📚 Documentation](#-documentation) • [🚀 Installation](#-installation) • [💡 Exemples](#-exemples) • [🛠️ API](#️-api)
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
</div>
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
## ✨ Composants disponibles
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
### 🪟 Système de Modal
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
- **ChrModalComponent** - Modal de base avec backdrop et animations
|
|
21
|
+
- **ModalService** - Service pour gérer les modals avec injection de tokens
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
### 📝 Formulaires et saisie
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
- **ChrFormComponent** - Formulaire dynamique avec sections et contrôles
|
|
26
|
+
- **ChrBaseInputComponent** - Input de base avec validation
|
|
27
|
+
- **ChrColorInputComponent** - Sélecteur de couleur
|
|
28
|
+
- **ChrDateInputComponent** - Input de date
|
|
29
|
+
- **ChrDatetimeInputComponent** - Input de date et heure
|
|
30
|
+
- **ChrFileInputComponent** - Upload de fichiers
|
|
31
|
+
- **ChrNiceFileInputComponent** - Upload de fichiers avec interface améliorée
|
|
32
|
+
- **ChrTextareaInputComponent** - Zone de texte multiligne
|
|
33
|
+
- **ChrToggleInputComponent** - Bouton toggle on/off
|
|
34
|
+
- **ChrSearchSelectComponent** - Sélection avec recherche
|
|
35
|
+
- **ChrTagSelectComponent** - Sélection multiple avec tags
|
|
36
|
+
- **ChrCheckboxComponent** - Case à cocher stylisée
|
|
22
37
|
|
|
23
|
-
|
|
38
|
+
### 📊 Affichage de données
|
|
24
39
|
|
|
25
|
-
|
|
40
|
+
- **ChrDataTableComponent** - Nouvelle version de table
|
|
41
|
+
- **ChrPaginatorComponent** - Pagination avec gestion des cookies
|
|
42
|
+
|
|
43
|
+
### 🎯 Interface utilisateur
|
|
44
|
+
|
|
45
|
+
- **ChrButtonComponent** - Bouton avec icônes et couleurs personnalisables
|
|
46
|
+
- **ChrButtonNewComponent** - Nouvelle version du bouton
|
|
47
|
+
- **ChrSpinnerComponent** - Indicateur de chargement
|
|
48
|
+
- **ChrToastComponent** - Notifications toast
|
|
49
|
+
- **ChrSeparatorComponent** - Séparateur visuel
|
|
50
|
+
- **ChrInlineSvgComponent** - Affichage SVG inline
|
|
51
|
+
|
|
52
|
+
### 🧭 Navigation
|
|
53
|
+
|
|
54
|
+
- **ChrBreadcrumbComponent** - Fil d'Ariane de navigation
|
|
55
|
+
- **ChrTabComponent** - Onglet individuel
|
|
56
|
+
- **ChrTabGroupComponent** - Groupe d'onglets
|
|
57
|
+
- **ChrCarouselComponent** - Carrousel d'images/contenu
|
|
58
|
+
|
|
59
|
+
### 🎛️ Directives
|
|
60
|
+
|
|
61
|
+
- **TabInputOnlyHandlerDirective** - Gestion navigation par Tab
|
|
62
|
+
- **TabToEnterHandlerDirective** - Conversion Tab vers Enter
|
|
63
|
+
- **AutofocusDirective** - Focus automatique
|
|
64
|
+
|
|
65
|
+
### 🛠️ Services
|
|
66
|
+
|
|
67
|
+
- **ModalService** - Gestion des modals avec tokens
|
|
68
|
+
- **DialogService** - Service de dialogue
|
|
69
|
+
- **DataService** - Service de données
|
|
70
|
+
- **LiveUpdateService** - Mises à jour en temps réel
|
|
71
|
+
- **LoaderService** - Gestion des états de chargement
|
|
72
|
+
- **ToastService** - Service de notifications
|
|
73
|
+
- **CookieService** - Gestion des cookies
|
|
74
|
+
- **FilesService** - Gestion des fichiers
|
|
75
|
+
|
|
76
|
+
## 🚀 Installation
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Installation avec toutes les dépendances
|
|
80
|
+
npm install chrv-components
|
|
81
|
+
|
|
82
|
+
# Les dépendances suivantes sont automatiquement incluses :
|
|
83
|
+
# - @angular/material
|
|
84
|
+
# - ngx-pagination
|
|
85
|
+
# - chrv-pipes
|
|
86
|
+
# - @microsoft/signalr
|
|
87
|
+
# - ngx-mask
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## ⚙️ Configuration
|
|
91
|
+
|
|
92
|
+
### Import dans votre module Angular
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
import { NgModule } from "@angular/core";
|
|
96
|
+
import { ChrButtonComponent, ChrFormComponent, ChrTableComponent, ModalService } from "chrv-components";
|
|
97
|
+
|
|
98
|
+
@NgModule({
|
|
99
|
+
imports: [ChrButtonComponent, ChrFormComponent, ChrTableComponent],
|
|
100
|
+
providers: [ModalService],
|
|
101
|
+
// ...
|
|
102
|
+
})
|
|
103
|
+
export class AppModule {}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Import dans un composant standalone
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { Component } from "@angular/core";
|
|
110
|
+
import { ChrButtonComponent, ChrSearchbarComponent } from "chrv-components";
|
|
111
|
+
|
|
112
|
+
@Component({
|
|
113
|
+
selector: "app-example",
|
|
114
|
+
standalone: true,
|
|
115
|
+
imports: [ChrButtonComponent, ChrSearchbarComponent],
|
|
116
|
+
template: `...`,
|
|
117
|
+
})
|
|
118
|
+
export class ExampleComponent {}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## 💡 Exemples d'utilisation
|
|
122
|
+
|
|
123
|
+
### 🎯 ChrButtonComponent
|
|
124
|
+
|
|
125
|
+
Bouton personnalisable avec icônes et couleurs :
|
|
126
|
+
|
|
127
|
+
```html
|
|
128
|
+
<!-- Bouton simple -->
|
|
129
|
+
<app-chr-button [display]="'Enregistrer'" [color]="'primary'" [click]="saveData"> </app-chr-button>
|
|
130
|
+
|
|
131
|
+
<!-- Bouton avec icône -->
|
|
132
|
+
<app-chr-button [display]="'Supprimer'" [icon]="'delete'" [color]="'warn'" [click]="deleteItem"> </app-chr-button>
|
|
133
|
+
|
|
134
|
+
<!-- Bouton plat -->
|
|
135
|
+
<app-chr-button [display]="'Annuler'" [flat]="true" [click]="cancel"> </app-chr-button>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 📝 ChrFormComponent
|
|
139
|
+
|
|
140
|
+
Formulaire dynamique avec sections et contrôles :
|
|
141
|
+
|
|
142
|
+
```html
|
|
143
|
+
<app-chr-form [sections]="formSections" [controls]="formControls"> </app-chr-form>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
export class FormExampleComponent {
|
|
148
|
+
formSections = [
|
|
149
|
+
{
|
|
150
|
+
title: "Informations personnelles",
|
|
151
|
+
controls: ["name", "email", "birthDate"],
|
|
152
|
+
},
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
formControls = {
|
|
156
|
+
name: { type: "text", label: "Nom", required: true },
|
|
157
|
+
email: { type: "email", label: "Email", required: true },
|
|
158
|
+
birthDate: { type: "date", label: "Date de naissance" },
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 🔍 ChrSearchbarComponent
|
|
164
|
+
|
|
165
|
+
Barre de recherche réactive :
|
|
166
|
+
|
|
167
|
+
```html
|
|
168
|
+
<app-chr-searchbar [model]="searchTerm" [placeholder]="'Rechercher...'" [label]="'Recherche'" (modelChange)="onSearchChange($event)"> </app-chr-searchbar>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
export class SearchExampleComponent {
|
|
173
|
+
searchTerm = "";
|
|
174
|
+
|
|
175
|
+
onSearchChange(term: string) {
|
|
176
|
+
this.searchTerm = term;
|
|
177
|
+
// Logique de recherche
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 📊 ChrPaginatorComponent
|
|
183
|
+
|
|
184
|
+
Pagination avec gestion automatique :
|
|
185
|
+
|
|
186
|
+
```html
|
|
187
|
+
<app-chr-paginator [id]="'users-pagination'" [maxSize]="5" [directionLinks]="true" [autoHide]="true"> </app-chr-paginator>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### 🪟 ModalService
|
|
191
|
+
|
|
192
|
+
Service pour gérer les modals avec injection de données :
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
import { Component, inject } from "@angular/core";
|
|
196
|
+
import { ModalService, MODAL_DATA, MODAL_REF } from "chrv-components";
|
|
197
|
+
|
|
198
|
+
// Composant de modal
|
|
199
|
+
@Component({
|
|
200
|
+
template: `
|
|
201
|
+
<div class="modal-content">
|
|
202
|
+
<h2>{{ data.title }}</h2>
|
|
203
|
+
<p>{{ data.message }}</p>
|
|
204
|
+
<button (click)="close()">Fermer</button>
|
|
205
|
+
</div>
|
|
206
|
+
`,
|
|
207
|
+
})
|
|
208
|
+
export class MyModalComponent {
|
|
209
|
+
data = inject(MODAL_DATA);
|
|
210
|
+
modalRef = inject(MODAL_REF);
|
|
211
|
+
|
|
212
|
+
close() {
|
|
213
|
+
this.modalRef.close();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Utilisation du service
|
|
218
|
+
export class ParentComponent {
|
|
219
|
+
private modalService = inject(ModalService);
|
|
220
|
+
|
|
221
|
+
openModal() {
|
|
222
|
+
this.modalService.open(MyModalComponent, {
|
|
223
|
+
title: "Confirmation",
|
|
224
|
+
message: "Êtes-vous sûr de vouloir continuer ?",
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### 🏷️ ChrTagSelectComponent
|
|
231
|
+
|
|
232
|
+
Sélection multiple avec tags :
|
|
233
|
+
|
|
234
|
+
```html
|
|
235
|
+
<app-chr-tag-select [options]="availableOptions" [selected]="selectedValues" (selectionChange)="onSelectionChange($event)"> </app-chr-tag-select>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### 🔄 ChrSpinnerComponent
|
|
239
|
+
|
|
240
|
+
Indicateur de chargement :
|
|
241
|
+
|
|
242
|
+
```html
|
|
243
|
+
<!-- Spinner simple -->
|
|
244
|
+
<app-chr-spinner></app-chr-spinner>
|
|
245
|
+
|
|
246
|
+
<!-- Spinner avec message -->
|
|
247
|
+
<app-chr-spinner [message]="'Chargement en cours...'"></app-chr-spinner>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## 🛠️ API
|
|
251
|
+
|
|
252
|
+
### ChrButtonComponent
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
@Component({
|
|
256
|
+
inputs: {
|
|
257
|
+
display: string; // Texte du bouton
|
|
258
|
+
icon: string; // Icône Material
|
|
259
|
+
click: Function; // Fonction onClick
|
|
260
|
+
color: Color; // Couleur du bouton
|
|
261
|
+
textColor: Color; // Couleur du texte
|
|
262
|
+
flat: boolean; // Style plat
|
|
263
|
+
}
|
|
264
|
+
})
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### ChrSearchbarComponent
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
@Component({
|
|
271
|
+
inputs: {
|
|
272
|
+
model: string | null; // Valeur actuelle
|
|
273
|
+
placeholder: string | null; // Texte d'aide
|
|
274
|
+
label: string | null; // Label du champ
|
|
275
|
+
},
|
|
276
|
+
outputs: {
|
|
277
|
+
modelChange: string; // Changement de valeur
|
|
278
|
+
}
|
|
279
|
+
})
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### ChrFormComponent
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
@Component({
|
|
286
|
+
inputs: {
|
|
287
|
+
sections: FormSection[]; // Sections du formulaire
|
|
288
|
+
controls: FormControls; // Configuration des contrôles
|
|
289
|
+
}
|
|
290
|
+
})
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### ModalService
|
|
294
|
+
|
|
295
|
+
```typescript
|
|
296
|
+
class ModalService {
|
|
297
|
+
open<T>(component: ComponentType<T>, data?: any): void;
|
|
298
|
+
close(): void;
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## 🎨 Thèmes et styles
|
|
303
|
+
|
|
304
|
+
Les composants utilisent Tailwind CSS et Angular Material. Vous pouvez personnaliser :
|
|
305
|
+
|
|
306
|
+
- **Couleurs** : Via les tokens de couleur (primary, secondary, warn, etc.)
|
|
307
|
+
- **Tailles** : Classes Tailwind CSS
|
|
308
|
+
- **Animations** : Animations Angular intégrées
|
|
309
|
+
|
|
310
|
+
## 📦 Intégrations
|
|
311
|
+
|
|
312
|
+
### Dépendances automatiques
|
|
313
|
+
|
|
314
|
+
- **Angular Material** - Composants Material Design
|
|
315
|
+
- **ngx-pagination** - Pagination avancée
|
|
316
|
+
- **chrv-pipes** - Pipes utilitaires
|
|
317
|
+
- **@microsoft/signalr** - Communication temps réel
|
|
318
|
+
- **ngx-mask** - Masques de saisie
|
|
319
|
+
|
|
320
|
+
### Interceptors et providers
|
|
321
|
+
|
|
322
|
+
```typescript
|
|
323
|
+
// Configuration automatique des interceptors
|
|
324
|
+
import {
|
|
325
|
+
SpinnerInterceptor,
|
|
326
|
+
XsrfInterceptor,
|
|
327
|
+
xsrfProvider
|
|
328
|
+
} from 'chrv-components';
|
|
329
|
+
|
|
330
|
+
@NgModule({
|
|
331
|
+
providers: [
|
|
332
|
+
xsrfProvider,
|
|
333
|
+
{ provide: HTTP_INTERCEPTORS, useClass: SpinnerInterceptor, multi: true },
|
|
334
|
+
{ provide: HTTP_INTERCEPTORS, useClass: XsrfInterceptor, multi: true }
|
|
335
|
+
]
|
|
336
|
+
})
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## 📝 Notes
|
|
340
|
+
|
|
341
|
+
- Compatible Angular 16+
|
|
342
|
+
- Composants standalone prêts pour le tree-shaking
|
|
343
|
+
- Types TypeScript complets
|
|
344
|
+
- Intégration Tailwind CSS native
|
|
345
|
+
- Support des signaux Angular modernes
|
|
346
|
+
|
|
347
|
+
## 🤝 Contribution
|
|
348
|
+
|
|
349
|
+
Les contributions sont les bienvenues ! Merci de respecter les conventions :
|
|
350
|
+
|
|
351
|
+
1. Utiliser les signaux Angular (`input()`, `output()`)
|
|
352
|
+
2. Préfixer les composants avec `chr-`
|
|
353
|
+
3. Documenter les APIs publiques
|
|
354
|
+
4. Tester les nouvelles fonctionnalités
|
|
355
|
+
|
|
356
|
+
## 📄 Licence
|
|
357
|
+
|
|
358
|
+
MIT © CHRV Components
|
|
Binary file
|