chrv-components 1.11.4 → 1.11.5

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 CHANGED
@@ -106,12 +106,12 @@ export class AppModule {}
106
106
 
107
107
  ```typescript
108
108
  import { Component } from "@angular/core";
109
- import { ChrButtonComponent, ChrSearchbarComponent } from "chrv-components";
109
+ import { ChrButtonComponent, ChrFormComponent } from "chrv-components";
110
110
 
111
111
  @Component({
112
112
  selector: "app-example",
113
113
  standalone: true,
114
- imports: [ChrButtonComponent, ChrSearchbarComponent],
114
+ imports: [ChrButtonComponent, ChrFormComponent],
115
115
  template: `...`,
116
116
  })
117
117
  export class ExampleComponent {}
@@ -177,31 +177,27 @@ export class FormExampleComponent {
177
177
  }
178
178
  ```
179
179
 
180
- ### 🔍 ChrSearchbarComponent
180
+ ### ChrPaginatorComponent
181
181
 
182
- Barre de recherche réactive :
182
+ Pagination avec gestion automatique :
183
183
 
184
184
  ```html
185
- <app-chr-searchbar [model]="searchTerm" [placeholder]="'Rechercher...'" [label]="'Recherche'" (modelChange)="onSearchChange($event)"> </app-chr-searchbar>
185
+ <app-chr-paginator [id]="'users-pagination'" [page]="currentPage" [pageSize]="itemsPerPage" [allowSizeChange]="true" (pageChange)="onPageChange($event)" (pageSizeChange)="onPageSizeChange($event)"> </app-chr-paginator>
186
186
  ```
187
187
 
188
188
  ```typescript
189
- export class SearchExampleComponent {
190
- searchTerm = "";
189
+ export class PaginationExampleComponent {
190
+ currentPage = 1;
191
+ itemsPerPage = 20;
191
192
 
192
- onSearchChange(term: string) {
193
- this.searchTerm = term;
194
- // Logique de recherche
193
+ onPageChange(page: number) {
194
+ this.currentPage = page;
195
195
  }
196
- }
197
- ```
198
-
199
- ### 📊 ChrPaginatorComponent
200
196
 
201
- Pagination avec gestion automatique :
202
-
203
- ```html
204
- <app-chr-paginator [id]="'users-pagination'" [maxSize]="5" [directionLinks]="true" [autoHide]="true"> </app-chr-paginator>
197
+ onPageSizeChange(size: number) {
198
+ this.itemsPerPage = size;
199
+ }
200
+ }
205
201
  ```
206
202
 
207
203
  ### 🪟 ModalService
@@ -251,19 +247,42 @@ export class ParentComponent {
251
247
  Sélection multiple avec tags :
252
248
 
253
249
  ```html
254
- <app-chr-tag-select [options]="availableOptions" [selected]="selectedValues" (selectionChange)="onSelectionChange($event)"> </app-chr-tag-select>
250
+ <app-chr-tag-select [data]="availableData" [display]="displayFunction" [placeholder]="'Sélectionner des éléments...'" [acceptText]="true"> </app-chr-tag-select>
251
+ ```
252
+
253
+ ```typescript
254
+ export class TagSelectExampleComponent {
255
+ availableData = [
256
+ { id: 1, name: "Option 1" },
257
+ { id: 2, name: "Option 2" },
258
+ { id: 3, name: "Option 3" },
259
+ ];
260
+
261
+ displayFunction = (item: any) => item.name;
262
+ }
255
263
  ```
256
264
 
257
265
  ### 🔄 ChrSpinnerComponent
258
266
 
259
- Indicateur de chargement :
267
+ Indicateur de chargement automatique :
260
268
 
261
269
  ```html
262
- <!-- Spinner simple -->
270
+ <!-- Spinner simple (contrôlé par LoaderService) -->
263
271
  <app-chr-spinner></app-chr-spinner>
272
+ ```
264
273
 
265
- <!-- Spinner avec message -->
266
- <app-chr-spinner [message]="'Chargement en cours...'"></app-chr-spinner>
274
+ ```typescript
275
+ export class SpinnerExampleComponent {
276
+ private loaderService = inject(LoaderService);
277
+
278
+ showSpinner() {
279
+ this.loaderService.show();
280
+ // Simulation d'une tâche
281
+ setTimeout(() => {
282
+ this.loaderService.hide();
283
+ }, 2000);
284
+ }
285
+ }
267
286
  ```
268
287
 
269
288
  ## 🛠️ API
@@ -332,6 +351,55 @@ interface IFormSection {
332
351
  }
333
352
  ```
334
353
 
354
+ ### ChrSearchbarComponent
355
+
356
+ ```typescript
357
+ @Component({
358
+ inputs: {
359
+ model: string | null; // Valeur actuelle
360
+ placeholder: string | null; // Texte d'aide
361
+ label: string | null; // Label du champ
362
+ },
363
+ outputs: {
364
+ modelChange: string; // Changement de valeur
365
+ }
366
+ })
367
+ ```
368
+
369
+ ### ChrPaginatorComponent
370
+
371
+ ```typescript
372
+ @Component({
373
+ inputs: {
374
+ page: number; // Page actuelle
375
+ pageSize: number; // Nombre d'éléments par page
376
+ id: string; // ID unique du paginateur
377
+ allowSizeChange: boolean | string; // Permet de changer la taille
378
+ },
379
+ outputs: {
380
+ pageChange: number; // Changement de page
381
+ pageSizeChange: number; // Changement de taille
382
+ }
383
+ })
384
+ ```
385
+
386
+ ### ChrTagSelectComponent
387
+
388
+ ```typescript
389
+ @Component({
390
+ inputs: {
391
+ placeholder: string; // Texte d'aide dans l'input
392
+ data: any[] | null; // Données pour l'autocomplete
393
+ display: (entry: any) => string; // Fonction d'affichage
394
+ filters: IInputSearchFilter[] | null; // Filtres de recherche
395
+ editCallback: Function; // Callback de modification
396
+ addCallback: Function; // Callback d'ajout
397
+ removeCallback: Function; // Callback de suppression
398
+ acceptText: boolean | null; // Accepte le texte libre
399
+ }
400
+ })
401
+ ```
402
+
335
403
  ### ModalService
336
404
 
337
405
  ```typescript
@@ -469,15 +537,6 @@ import {
469
537
  - Intégration Tailwind CSS native
470
538
  - Support des signaux Angular modernes
471
539
 
472
- ## 🤝 Contribution
473
-
474
- Les contributions sont les bienvenues ! Merci de respecter les conventions :
475
-
476
- 1. Utiliser les signaux Angular (`input()`, `output()`)
477
- 2. Préfixer les composants avec `chr-`
478
- 3. Documenter les APIs publiques
479
- 4. Tester les nouvelles fonctionnalités
480
-
481
540
  ## 📄 Licence
482
541
 
483
542
  MIT © CHRV Components
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrv-components",
3
- "version": "1.11.4",
3
+ "version": "1.11.5",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=17.0.0",
6
6
  "@angular/core": ">=17.0.0",
Binary file