chrv-components 1.11.4 → 1.11.6

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