c3-components 0.9.3 → 0.10.0

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { TemplateRef, Component, ViewChild, Input, forwardRef, Directive, HostListener, NgModule, Inject, signal, ViewContainerRef, inject, Injector, effect, Injectable, Pipe, EventEmitter, Output, ViewEncapsulation, Optional, input, output, computed, viewChild, HostBinding, model, ElementRef, contentChild, contentChildren } from '@angular/core';
2
+ import { TemplateRef, Component, ViewChild, Input, forwardRef, Directive, HostListener, NgModule, Inject, signal, ViewContainerRef, viewChild, inject, Injector, effect, Injectable, input, Pipe, EventEmitter, Output, ViewEncapsulation, Optional, output, computed, HostBinding, model, ElementRef, contentChild, contentChildren } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import * as i2$1 from '@angular/forms';
@@ -217,6 +217,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
217
217
  }]
218
218
  }] });
219
219
 
220
+ class C3AlertDialogComponent {
221
+ constructor(dialogRef, data) {
222
+ this.dialogRef = dialogRef;
223
+ this.data = data;
224
+ }
225
+ onNoClick() {
226
+ this.dialogRef.close();
227
+ }
228
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3AlertDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
229
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: C3AlertDialogComponent, isStandalone: false, selector: "AlertDialogComponent", ngImport: i0, template: `
230
+ <mat-dialog-content>
231
+ <div [innerHtml]="data.text"></div>
232
+ </mat-dialog-content>
233
+ <mat-dialog-actions>
234
+ <button mat-button [mat-dialog-close]="true">
235
+ {{ data.acceptText || 'ok' }}
236
+ </button>
237
+ </mat-dialog-actions>
238
+ `, isInline: true, dependencies: [{ kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: i1$2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }] }); }
239
+ }
240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3AlertDialogComponent, decorators: [{
241
+ type: Component,
242
+ args: [{
243
+ selector: 'AlertDialogComponent',
244
+ template: `
245
+ <mat-dialog-content>
246
+ <div [innerHtml]="data.text"></div>
247
+ </mat-dialog-content>
248
+ <mat-dialog-actions>
249
+ <button mat-button [mat-dialog-close]="true">
250
+ {{ data.acceptText || 'ok' }}
251
+ </button>
252
+ </mat-dialog-actions>
253
+ `,
254
+ standalone: false
255
+ }]
256
+ }], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
257
+ type: Inject,
258
+ args: [MAT_DIALOG_DATA]
259
+ }] }] });
260
+
220
261
  class ConfirmDialogComponent {
221
262
  constructor(dialogRef, data) {
222
263
  this.dialogRef = dialogRef;
@@ -354,185 +395,234 @@ class C3DialogEmbedChildComponent {
354
395
  this.dialogRef = dialogRef;
355
396
  this.data = data;
356
397
  this._cdr = _cdr;
398
+ // On utilise un signal pour stocker la référence du composant créé
357
399
  this.createdComponent = signal(null);
358
400
  }
359
401
  ngAfterViewInit() {
360
- this.createdComponent.set(this.target.createComponent(this.data.component));
361
- // detect the inputs of the component
362
- if (!this.createdComponent)
402
+ // Si on a un composant, on le crée dynamiquement
403
+ if (this.data.component && !this.data.templateRef) {
404
+ const compRef = this.target.createComponent(this.data.component);
405
+ this.createdComponent.set(compRef);
406
+ // Injecter les inputs dans le composant
407
+ if (this.data.inputs) {
408
+ this._setInputs(this.data.component, this.data.inputs, compRef);
409
+ }
410
+ }
411
+ // Si on a juste un templateRef, on ne crée pas de composant :
412
+ // l’affichage est déjà géré dans le template via <ng-template *ngTemplateOutlet="...">
413
+ else if (this.data.templateRef) {
414
+ this.createdComponent.set(null);
415
+ }
416
+ // Si on n’a rien, on ferme le dialog
417
+ else {
363
418
  this.dialogRef.close(false);
364
- if (this.data.inputs)
365
- this._setInputs(this.data.component, this.data.inputs, this.createdComponent());
419
+ }
420
+ // Déclenche manuellement le cycle de détection pour actualiser l'affichage
366
421
  this._cdr.detectChanges();
367
422
  }
423
+ /**
424
+ * Retourne la référence du composant créé (s’il y en a un),
425
+ * utile pour le service ou l’appelant.
426
+ */
427
+ createdComponentInstance() {
428
+ return this.createdComponent();
429
+ }
430
+ // Récupère la liste des @Input déclarés sur le composant
368
431
  _getInputProperties(component) {
369
432
  const inputs = [];
370
433
  const declaredInputs = component.prototype?.constructor['ɵcmp']?.declaredInputs;
371
- for (const input of Object.keys(declaredInputs))
434
+ for (const input of Object.keys(declaredInputs)) {
372
435
  inputs.push(input);
436
+ }
373
437
  return inputs;
374
438
  }
439
+ // Assigne les inputs passés en configuration au composant dynamique
375
440
  _setInputs(component, inputs, componentRef) {
376
441
  const inputProperties = this._getInputProperties(component);
377
442
  for (const key of inputProperties) {
378
- if (inputs[key]) {
443
+ if (inputs[key] !== undefined) {
379
444
  componentRef.setInput(key, inputs[key]);
380
445
  }
381
446
  }
382
- return component;
383
447
  }
384
448
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3DialogEmbedChildComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
385
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: C3DialogEmbedChildComponent, isStandalone: false, selector: "C3DialogEmbedChildComponent", viewQueries: [{ propertyName: "target", first: true, predicate: ["target"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: `<div [class]="'dialog-content-container ' + (data.classContainer || '')">
386
- @if(data.toolbar) {
387
- <mat-toolbar
388
- [color]="data.toolbar.color || 'default'"
389
- class="py-1"
390
- >
391
- <span>{{ data.toolbar.title }}</span>
392
- <span class="spacer"></span>
393
- <button
394
- *ngIf="data.toolbar.closeBtn"
395
- mat-icon-button
396
- mat-dialog-close
397
- color="{{ data.toolbar.closeColor }}"
449
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: C3DialogEmbedChildComponent, isStandalone: false, selector: "C3DialogEmbedChildComponent", viewQueries: [{ propertyName: "target", first: true, predicate: ["target"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: `
450
+ <div [class]="'dialog-content-container ' + (data.classContainer || '')">
451
+ @if (data.toolbar) {
452
+ <mat-toolbar
453
+ [color]="data.toolbar.color || 'default'"
454
+ class="py-1"
398
455
  >
399
- <mat-icon>close</mat-icon>
400
- </button>
401
- </mat-toolbar>
402
- }
403
- <div [class]="'dialog-content '+ (data.classContent || '')">
404
- <ng-template #target></ng-template>
405
- </div>
406
- @if(data.actions && data.actions.length > 0) {
407
- <div [class]="'dialog-actions' + (data.classActions || '')">
408
- @for(action of data.actions; track action.label) {
409
- @switch (action.apperance) {
410
- @case ('basic') {
411
- <button
412
- [class]="action.class"
413
- (click)="action.action()"
414
- >
415
- {{ action.label }}
416
- </button>
417
- }
418
- @case ('raised') {
419
- <button
420
- mat-raised-button
421
- [class]="action.class"
422
- (click)="action.action()"
423
- >
424
- {{ action.label }}
425
- </button>
426
- }
427
- @case ('stroked') {
428
- <button
429
- mat-stroked-button
430
- [class]="action.class"
431
- (click)="action.action()"
432
- >
433
- {{ action.label }}
434
- </button>
435
- }
436
- @case ('flat') {
437
- <button
438
- mat-flat-button
439
- [class]="action.class"
440
- (click)="action.action()"
441
- >
442
- {{ action.label }}
443
- </button>
444
- }
445
- @default {
446
- <button
447
- mat-button
448
- [class]="action.class"
449
- (click)="action.action()"
450
- >
451
- {{ action.label }}
452
- </button>
453
- }
454
- }
456
+ <span>{{ data.toolbar.title }}</span>
457
+ <span class="spacer"></span>
458
+ <button
459
+ *ngIf="data.toolbar.closeBtn"
460
+ mat-icon-button
461
+ mat-dialog-close
462
+ color="{{ data.toolbar.closeColor }}"
463
+ >
464
+ <mat-icon>close</mat-icon>
465
+ </button>
466
+ </mat-toolbar>
467
+ }
468
+
469
+ <div [class]="'dialog-content ' + (data.classContent || '')">
470
+ <!-- Si templateRef est présent, on l'affiche directement,
471
+ sinon on laisse la place au composant dynamique -->
472
+ @if (data.templateRef) {
473
+ <ng-container
474
+ *ngTemplateOutlet="data.templateRef"
475
+ ></ng-container>
476
+ }
477
+ @else {
478
+ <ng-template #target></ng-template>
455
479
  }
456
480
  </div>
457
- }
458
- </div>`, isInline: true, styles: [".dialog-content-container{display:flex;flex-direction:column;height:100%;padding:1rem;overflow:auto}.dialog-content-container .dialog-content{display:flex;flex-direction:column;height:100%;overflow:auto;flex-grow:1}.dialog-content-container .mat-toolbar{display:flex;justify-content:space-between;align-items:center;border-radius:.25rem}.dialog-content-container .mat-toolbar span{color:inherit}.dialog-content-container .spacer{flex:1 1 auto;min-width:16px}.dialog-actions{display:flex;justify-content:flex-end;gap:.5rem}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "directive", type: i1$2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "component", type: i2$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5$1.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }] }); }
481
+
482
+ @if (data.actions && data.actions.length > 0) {
483
+ <div [class]="'dialog-actions ' + (data.classActions || '')">
484
+ @for (action of data.actions; track action.label) {
485
+ @switch (action.apperance) {
486
+ @case ('basic') {
487
+ <button
488
+ [class]="action.class"
489
+ (click)="action.action()"
490
+ >
491
+ {{ action.label }}
492
+ </button>
493
+ }
494
+ @case ('raised') {
495
+ <button
496
+ mat-raised-button
497
+ [class]="action.class"
498
+ (click)="action.action()"
499
+ >
500
+ {{ action.label }}
501
+ </button>
502
+ }
503
+ @case ('stroked') {
504
+ <button
505
+ mat-stroked-button
506
+ [class]="action.class"
507
+ (click)="action.action()"
508
+ >
509
+ {{ action.label }}
510
+ </button>
511
+ }
512
+ @case ('flat') {
513
+ <button
514
+ mat-flat-button
515
+ [class]="action.class"
516
+ (click)="action.action()"
517
+ >
518
+ {{ action.label }}
519
+ </button>
520
+ }
521
+ @default {
522
+ <button
523
+ mat-button
524
+ [class]="action.class"
525
+ (click)="action.action()"
526
+ >
527
+ {{ action.label }}
528
+ </button>
529
+ }
530
+ }
531
+ }
532
+ </div>
533
+ }
534
+ </div>
535
+ `, isInline: true, styles: [".dialog-content-container{display:flex;flex-direction:column;height:100%;padding:1rem;overflow:auto}.dialog-content-container .dialog-content{display:flex;flex-direction:column;height:100%;overflow:auto;flex-grow:1}.dialog-content-container .mat-toolbar{display:flex;justify-content:space-between;align-items:center;border-radius:.25rem}.dialog-content-container .mat-toolbar span{color:inherit}.dialog-content-container .spacer{flex:1 1 auto;min-width:16px}.dialog-actions{display:flex;justify-content:flex-end;gap:.5rem}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "directive", type: i1$2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "component", type: i2$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5$1.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }] }); }
459
536
  }
460
537
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3DialogEmbedChildComponent, decorators: [{
461
538
  type: Component,
462
- args: [{ selector: 'C3DialogEmbedChildComponent', template: `<div [class]="'dialog-content-container ' + (data.classContainer || '')">
463
- @if(data.toolbar) {
464
- <mat-toolbar
465
- [color]="data.toolbar.color || 'default'"
466
- class="py-1"
467
- >
468
- <span>{{ data.toolbar.title }}</span>
469
- <span class="spacer"></span>
470
- <button
471
- *ngIf="data.toolbar.closeBtn"
472
- mat-icon-button
473
- mat-dialog-close
474
- color="{{ data.toolbar.closeColor }}"
539
+ args: [{ selector: 'C3DialogEmbedChildComponent', template: `
540
+ <div [class]="'dialog-content-container ' + (data.classContainer || '')">
541
+ @if (data.toolbar) {
542
+ <mat-toolbar
543
+ [color]="data.toolbar.color || 'default'"
544
+ class="py-1"
475
545
  >
476
- <mat-icon>close</mat-icon>
477
- </button>
478
- </mat-toolbar>
479
- }
480
- <div [class]="'dialog-content '+ (data.classContent || '')">
481
- <ng-template #target></ng-template>
482
- </div>
483
- @if(data.actions && data.actions.length > 0) {
484
- <div [class]="'dialog-actions' + (data.classActions || '')">
485
- @for(action of data.actions; track action.label) {
486
- @switch (action.apperance) {
487
- @case ('basic') {
488
- <button
489
- [class]="action.class"
490
- (click)="action.action()"
491
- >
492
- {{ action.label }}
493
- </button>
494
- }
495
- @case ('raised') {
496
- <button
497
- mat-raised-button
498
- [class]="action.class"
499
- (click)="action.action()"
500
- >
501
- {{ action.label }}
502
- </button>
503
- }
504
- @case ('stroked') {
505
- <button
506
- mat-stroked-button
507
- [class]="action.class"
508
- (click)="action.action()"
509
- >
510
- {{ action.label }}
511
- </button>
512
- }
513
- @case ('flat') {
514
- <button
515
- mat-flat-button
516
- [class]="action.class"
517
- (click)="action.action()"
518
- >
519
- {{ action.label }}
520
- </button>
521
- }
522
- @default {
523
- <button
524
- mat-button
525
- [class]="action.class"
526
- (click)="action.action()"
527
- >
528
- {{ action.label }}
529
- </button>
530
- }
531
- }
546
+ <span>{{ data.toolbar.title }}</span>
547
+ <span class="spacer"></span>
548
+ <button
549
+ *ngIf="data.toolbar.closeBtn"
550
+ mat-icon-button
551
+ mat-dialog-close
552
+ color="{{ data.toolbar.closeColor }}"
553
+ >
554
+ <mat-icon>close</mat-icon>
555
+ </button>
556
+ </mat-toolbar>
557
+ }
558
+
559
+ <div [class]="'dialog-content ' + (data.classContent || '')">
560
+ <!-- Si templateRef est présent, on l'affiche directement,
561
+ sinon on laisse la place au composant dynamique -->
562
+ @if (data.templateRef) {
563
+ <ng-container
564
+ *ngTemplateOutlet="data.templateRef"
565
+ ></ng-container>
566
+ }
567
+ @else {
568
+ <ng-template #target></ng-template>
532
569
  }
533
570
  </div>
534
- }
535
- </div>`, standalone: false, styles: [".dialog-content-container{display:flex;flex-direction:column;height:100%;padding:1rem;overflow:auto}.dialog-content-container .dialog-content{display:flex;flex-direction:column;height:100%;overflow:auto;flex-grow:1}.dialog-content-container .mat-toolbar{display:flex;justify-content:space-between;align-items:center;border-radius:.25rem}.dialog-content-container .mat-toolbar span{color:inherit}.dialog-content-container .spacer{flex:1 1 auto;min-width:16px}.dialog-actions{display:flex;justify-content:flex-end;gap:.5rem}\n"] }]
571
+
572
+ @if (data.actions && data.actions.length > 0) {
573
+ <div [class]="'dialog-actions ' + (data.classActions || '')">
574
+ @for (action of data.actions; track action.label) {
575
+ @switch (action.apperance) {
576
+ @case ('basic') {
577
+ <button
578
+ [class]="action.class"
579
+ (click)="action.action()"
580
+ >
581
+ {{ action.label }}
582
+ </button>
583
+ }
584
+ @case ('raised') {
585
+ <button
586
+ mat-raised-button
587
+ [class]="action.class"
588
+ (click)="action.action()"
589
+ >
590
+ {{ action.label }}
591
+ </button>
592
+ }
593
+ @case ('stroked') {
594
+ <button
595
+ mat-stroked-button
596
+ [class]="action.class"
597
+ (click)="action.action()"
598
+ >
599
+ {{ action.label }}
600
+ </button>
601
+ }
602
+ @case ('flat') {
603
+ <button
604
+ mat-flat-button
605
+ [class]="action.class"
606
+ (click)="action.action()"
607
+ >
608
+ {{ action.label }}
609
+ </button>
610
+ }
611
+ @default {
612
+ <button
613
+ mat-button
614
+ [class]="action.class"
615
+ (click)="action.action()"
616
+ >
617
+ {{ action.label }}
618
+ </button>
619
+ }
620
+ }
621
+ }
622
+ </div>
623
+ }
624
+ </div>
625
+ `, standalone: false, styles: [".dialog-content-container{display:flex;flex-direction:column;height:100%;padding:1rem;overflow:auto}.dialog-content-container .dialog-content{display:flex;flex-direction:column;height:100%;overflow:auto;flex-grow:1}.dialog-content-container .mat-toolbar{display:flex;justify-content:space-between;align-items:center;border-radius:.25rem}.dialog-content-container .mat-toolbar span{color:inherit}.dialog-content-container .spacer{flex:1 1 auto;min-width:16px}.dialog-actions{display:flex;justify-content:flex-end;gap:.5rem}\n"] }]
536
626
  }], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
537
627
  type: Inject,
538
628
  args: [MAT_DIALOG_DATA]
@@ -541,46 +631,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
541
631
  args: ['target', { read: ViewContainerRef }]
542
632
  }] } });
543
633
 
544
- class C3AlertDialogComponent {
545
- constructor(dialogRef, data) {
546
- this.dialogRef = dialogRef;
547
- this.data = data;
548
- }
549
- onNoClick() {
550
- this.dialogRef.close();
634
+ class C3DialogTemplateComponent {
635
+ constructor() {
636
+ this.templateRef = viewChild('internalTemplate', {
637
+ read: TemplateRef,
638
+ });
551
639
  }
552
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3AlertDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
553
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: C3AlertDialogComponent, isStandalone: false, selector: "AlertDialogComponent", ngImport: i0, template: `
554
- <mat-dialog-content>
555
- <div [innerHtml]="data.text"></div>
556
- </mat-dialog-content>
557
- <mat-dialog-actions>
558
- <button mat-button [mat-dialog-close]="true">
559
- {{ data.acceptText || 'ok' }}
560
- </button>
561
- </mat-dialog-actions>
562
- `, isInline: true, dependencies: [{ kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: i1$2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }] }); }
640
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3DialogTemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
641
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.4", type: C3DialogTemplateComponent, isStandalone: false, selector: "c3-dialog-template", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["internalTemplate"], descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "<ng-template #internalTemplate>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{display:block}\n"] }); }
563
642
  }
564
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3AlertDialogComponent, decorators: [{
643
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3DialogTemplateComponent, decorators: [{
565
644
  type: Component,
566
- args: [{
567
- selector: 'AlertDialogComponent',
568
- template: `
569
- <mat-dialog-content>
570
- <div [innerHtml]="data.text"></div>
571
- </mat-dialog-content>
572
- <mat-dialog-actions>
573
- <button mat-button [mat-dialog-close]="true">
574
- {{ data.acceptText || 'ok' }}
575
- </button>
576
- </mat-dialog-actions>
577
- `,
578
- standalone: false
579
- }]
580
- }], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
581
- type: Inject,
582
- args: [MAT_DIALOG_DATA]
583
- }] }] });
645
+ args: [{ selector: 'c3-dialog-template', standalone: false, template: "<ng-template #internalTemplate>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{display:block}\n"] }]
646
+ }] });
584
647
 
585
648
  class C3DialogService {
586
649
  constructor() {
@@ -681,6 +744,23 @@ class C3DialogService {
681
744
  });
682
745
  return this.createC3DialogResult(dialog);
683
746
  }
747
+ /**
748
+ * Ouvre un dialog à partir d'un TemplateRef.
749
+ * @param templateRef Le TemplateRef à afficher dans la boîte de dialogue.
750
+ * @param config (optionnel) Configuration pour le MatDialog (dimensions, position, etc.).
751
+ */
752
+ createDialogFromTemplate(templateRef, config) {
753
+ // On ouvre le même composant hôte (C3DialogEmbedChildComponent)
754
+ // mais on lui passe un paramètre templateRef plutôt qu'un component.
755
+ const dialogRef = this.#dialog.open((C3DialogEmbedChildComponent), {
756
+ ...config,
757
+ data: {
758
+ templateRef,
759
+ },
760
+ });
761
+ // On réutilise la méthode générique pour envelopper le MatDialogRef
762
+ return this.createC3DialogResult(dialogRef);
763
+ }
684
764
  alert(text, data) {
685
765
  const dialogRef = this.#dialog.open(C3AlertDialogComponent, {
686
766
  data: {
@@ -735,12 +815,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
735
815
  }]
736
816
  }] });
737
817
 
818
+ class C3OpenDialogDirective {
819
+ constructor() {
820
+ this.template = input(undefined, {
821
+ alias: 'c3-dialog'
822
+ });
823
+ this._dialog = inject(C3DialogService);
824
+ }
825
+ openDialog($event) {
826
+ if (!this.template()?.templateRef())
827
+ return;
828
+ this._dialog.createDialogFromTemplate(this.template().templateRef());
829
+ }
830
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3OpenDialogDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
831
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.4", type: C3OpenDialogDirective, isStandalone: false, selector: "[c3-dialog]", inputs: { template: { classPropertyName: "template", publicName: "c3-dialog", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "openDialog($event)" } }, ngImport: i0 }); }
832
+ }
833
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3OpenDialogDirective, decorators: [{
834
+ type: Directive,
835
+ args: [{
836
+ selector: '[c3-dialog]',
837
+ standalone: false,
838
+ host: {
839
+ '(click)': 'openDialog($event)'
840
+ }
841
+ }]
842
+ }] });
843
+
738
844
  class C3DialogModule {
739
845
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3DialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
740
846
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: C3DialogModule, declarations: [C3AlertDialogComponent,
741
847
  ConfirmDialogComponent,
742
848
  C3PromptDialogComponent,
743
- C3DialogEmbedChildComponent], imports: [CommonModule,
849
+ C3DialogEmbedChildComponent,
850
+ C3DialogTemplateComponent,
851
+ C3OpenDialogDirective], imports: [CommonModule,
744
852
  FormsModule,
745
853
  MatButtonModule,
746
854
  MatDialogModule,
@@ -748,7 +856,8 @@ class C3DialogModule {
748
856
  MatIconModule,
749
857
  MatInputModule,
750
858
  MatToolbarModule,
751
- ReactiveFormsModule] }); }
859
+ ReactiveFormsModule], exports: [C3DialogTemplateComponent,
860
+ C3OpenDialogDirective] }); }
752
861
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3DialogModule, providers: [C3DialogService], imports: [CommonModule,
753
862
  FormsModule,
754
863
  MatButtonModule,
@@ -767,6 +876,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
767
876
  ConfirmDialogComponent,
768
877
  C3PromptDialogComponent,
769
878
  C3DialogEmbedChildComponent,
879
+ C3DialogTemplateComponent,
880
+ C3OpenDialogDirective,
770
881
  ],
771
882
  imports: [
772
883
  CommonModule,
@@ -779,6 +890,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
779
890
  MatToolbarModule,
780
891
  ReactiveFormsModule,
781
892
  ],
893
+ exports: [
894
+ C3DialogTemplateComponent,
895
+ C3OpenDialogDirective
896
+ ],
782
897
  providers: [C3DialogService],
783
898
  }]
784
899
  }] });
@@ -2064,5 +2179,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
2064
2179
  * Generated bundle index. Do not edit.
2065
2180
  */
2066
2181
 
2067
- export { C3AutoAnimateDirective, C3DialogEmbedChildComponent, C3DialogModule, C3DialogService, C3DropdownComponent, C3DropdownModule, C3DropdownTrigger, C3ExpansionComponent, C3ExpansionHeaderComponent, C3ExpansionModule, C3FileDisplayCardComponent, C3FileDisplayGridComponent, C3FileDisplayIconComponent, C3FileDisplayListComponent, C3FileDisplayerModule, C3FileViewer, C3FileViewerComponent, C3FileViewerDialog, C3FileViewerDialogComponent, C3FileViewerModule, C3FlowingMenuComponent, C3FlowingMenuItemComponent, C3FlowingMenuItemContentComponent, C3FlowingMenuModule, C3PreventClickDirective, C3PreventKeyboardEventDirective, C3PromptDialogComponent, C3SafeUrlPipe, C3SelectOnFocusDirective, C3StopPropagationDirective, C3TraceCardAlignLeftDirective, C3TraceCardAlignRightDirective, C3TraceCardComponent, C3TraceCardContentComponent, C3TraceCardModule, C3TraceCardTitleComponent, C3TreeComponent, ConfirmDialogComponent, CustomFileEvent, FullScreenDirective, MAT_DROPDOWN_VALUE_ACCESSOR, booleanSignal };
2182
+ export { C3AlertDialogComponent, C3AutoAnimateDirective, C3DialogEmbedChildComponent, C3DialogModule, C3DialogService, C3DialogTemplateComponent, C3DropdownComponent, C3DropdownModule, C3DropdownTrigger, C3ExpansionComponent, C3ExpansionHeaderComponent, C3ExpansionModule, C3FileDisplayCardComponent, C3FileDisplayGridComponent, C3FileDisplayIconComponent, C3FileDisplayListComponent, C3FileDisplayerModule, C3FileViewer, C3FileViewerComponent, C3FileViewerDialog, C3FileViewerDialogComponent, C3FileViewerModule, C3FlowingMenuComponent, C3FlowingMenuItemComponent, C3FlowingMenuItemContentComponent, C3FlowingMenuModule, C3OpenDialogDirective, C3PreventClickDirective, C3PreventKeyboardEventDirective, C3PromptDialogComponent, C3SafeUrlPipe, C3SelectOnFocusDirective, C3StopPropagationDirective, C3TraceCardAlignLeftDirective, C3TraceCardAlignRightDirective, C3TraceCardComponent, C3TraceCardContentComponent, C3TraceCardModule, C3TraceCardTitleComponent, C3TreeComponent, ConfirmDialogComponent, CustomFileEvent, FullScreenDirective, MAT_DROPDOWN_VALUE_ACCESSOR, booleanSignal };
2068
2183
  //# sourceMappingURL=c3-components.mjs.map