c3-components 0.9.3 → 0.10.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/fesm2022/c3-components.mjs +308 -191
- package/fesm2022/c3-components.mjs.map +1 -1
- package/lib/c3-dialog/c3-dialog.module.d.ts +11 -9
- package/lib/c3-dialog/components/c3-dialog-embed-child.component.d.ts +10 -3
- package/lib/c3-dialog/components/c3-dialog-template/c3-dialog-template.component.d.ts +9 -0
- package/lib/c3-dialog/components/c3-dialog-template/c3-dialog-template.component.scss +3 -0
- package/lib/c3-dialog/directives/c3-open-dialog.directive.d.ts +9 -0
- package/lib/c3-dialog/services/c3-dialog.service.d.ts +7 -1
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
|
@@ -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,
|
|
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
|
-
|
|
361
|
-
|
|
362
|
-
|
|
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
|
-
|
|
365
|
-
|
|
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:
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
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
|
-
<
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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
|
-
|
|
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:
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
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
|
-
<
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
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
|
-
|
|
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,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
541
631
|
args: ['target', { read: ViewContainerRef }]
|
|
542
632
|
}] } });
|
|
543
633
|
|
|
544
|
-
class
|
|
545
|
-
constructor(
|
|
546
|
-
this.
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
this.dialogRef.close();
|
|
634
|
+
class C3DialogTemplateComponent {
|
|
635
|
+
constructor() {
|
|
636
|
+
this.templateRef = viewChild('internalTemplate', {
|
|
637
|
+
read: TemplateRef,
|
|
638
|
+
});
|
|
639
|
+
this.dialogRef = signal(null);
|
|
551
640
|
}
|
|
552
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type:
|
|
553
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
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]" }] }); }
|
|
641
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3DialogTemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
642
|
+
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
643
|
}
|
|
564
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type:
|
|
644
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3DialogTemplateComponent, decorators: [{
|
|
565
645
|
type: Component,
|
|
566
|
-
args: [{
|
|
567
|
-
|
|
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
|
-
}] }] });
|
|
646
|
+
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"] }]
|
|
647
|
+
}] });
|
|
584
648
|
|
|
585
649
|
class C3DialogService {
|
|
586
650
|
constructor() {
|
|
@@ -681,6 +745,23 @@ class C3DialogService {
|
|
|
681
745
|
});
|
|
682
746
|
return this.createC3DialogResult(dialog);
|
|
683
747
|
}
|
|
748
|
+
/**
|
|
749
|
+
* Ouvre un dialog à partir d'un TemplateRef.
|
|
750
|
+
* @param templateRef Le TemplateRef à afficher dans la boîte de dialogue.
|
|
751
|
+
* @param config (optionnel) Configuration pour le MatDialog (dimensions, position, etc.).
|
|
752
|
+
*/
|
|
753
|
+
createDialogFromTemplate(templateRef, config) {
|
|
754
|
+
// On ouvre le même composant hôte (C3DialogEmbedChildComponent)
|
|
755
|
+
// mais on lui passe un paramètre templateRef plutôt qu'un component.
|
|
756
|
+
const dialogRef = this.#dialog.open((C3DialogEmbedChildComponent), {
|
|
757
|
+
...config,
|
|
758
|
+
data: {
|
|
759
|
+
templateRef,
|
|
760
|
+
},
|
|
761
|
+
});
|
|
762
|
+
// On réutilise la méthode générique pour envelopper le MatDialogRef
|
|
763
|
+
return this.createC3DialogResult(dialogRef);
|
|
764
|
+
}
|
|
684
765
|
alert(text, data) {
|
|
685
766
|
const dialogRef = this.#dialog.open(C3AlertDialogComponent, {
|
|
686
767
|
data: {
|
|
@@ -735,12 +816,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
735
816
|
}]
|
|
736
817
|
}] });
|
|
737
818
|
|
|
819
|
+
class C3OpenDialogDirective {
|
|
820
|
+
constructor() {
|
|
821
|
+
this.template = input(undefined, {
|
|
822
|
+
alias: 'c3-dialog'
|
|
823
|
+
});
|
|
824
|
+
this._dialog = inject(C3DialogService);
|
|
825
|
+
}
|
|
826
|
+
openDialog($event) {
|
|
827
|
+
if (!this.template()?.templateRef())
|
|
828
|
+
return;
|
|
829
|
+
const dialog = this._dialog.createDialogFromTemplate(this.template().templateRef());
|
|
830
|
+
this.template()?.dialogRef.set(dialog);
|
|
831
|
+
}
|
|
832
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3OpenDialogDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
833
|
+
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 }); }
|
|
834
|
+
}
|
|
835
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3OpenDialogDirective, decorators: [{
|
|
836
|
+
type: Directive,
|
|
837
|
+
args: [{
|
|
838
|
+
selector: '[c3-dialog]',
|
|
839
|
+
standalone: false,
|
|
840
|
+
host: {
|
|
841
|
+
'(click)': 'openDialog($event)'
|
|
842
|
+
}
|
|
843
|
+
}]
|
|
844
|
+
}] });
|
|
845
|
+
|
|
738
846
|
class C3DialogModule {
|
|
739
847
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3DialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
740
848
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: C3DialogModule, declarations: [C3AlertDialogComponent,
|
|
741
849
|
ConfirmDialogComponent,
|
|
742
850
|
C3PromptDialogComponent,
|
|
743
|
-
C3DialogEmbedChildComponent
|
|
851
|
+
C3DialogEmbedChildComponent,
|
|
852
|
+
C3DialogTemplateComponent,
|
|
853
|
+
C3OpenDialogDirective], imports: [CommonModule,
|
|
744
854
|
FormsModule,
|
|
745
855
|
MatButtonModule,
|
|
746
856
|
MatDialogModule,
|
|
@@ -748,7 +858,8 @@ class C3DialogModule {
|
|
|
748
858
|
MatIconModule,
|
|
749
859
|
MatInputModule,
|
|
750
860
|
MatToolbarModule,
|
|
751
|
-
ReactiveFormsModule]
|
|
861
|
+
ReactiveFormsModule], exports: [C3DialogTemplateComponent,
|
|
862
|
+
C3OpenDialogDirective] }); }
|
|
752
863
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3DialogModule, providers: [C3DialogService], imports: [CommonModule,
|
|
753
864
|
FormsModule,
|
|
754
865
|
MatButtonModule,
|
|
@@ -767,6 +878,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
767
878
|
ConfirmDialogComponent,
|
|
768
879
|
C3PromptDialogComponent,
|
|
769
880
|
C3DialogEmbedChildComponent,
|
|
881
|
+
C3DialogTemplateComponent,
|
|
882
|
+
C3OpenDialogDirective,
|
|
770
883
|
],
|
|
771
884
|
imports: [
|
|
772
885
|
CommonModule,
|
|
@@ -779,6 +892,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
779
892
|
MatToolbarModule,
|
|
780
893
|
ReactiveFormsModule,
|
|
781
894
|
],
|
|
895
|
+
exports: [
|
|
896
|
+
C3DialogTemplateComponent,
|
|
897
|
+
C3OpenDialogDirective
|
|
898
|
+
],
|
|
782
899
|
providers: [C3DialogService],
|
|
783
900
|
}]
|
|
784
901
|
}] });
|
|
@@ -2064,5 +2181,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
2064
2181
|
* Generated bundle index. Do not edit.
|
|
2065
2182
|
*/
|
|
2066
2183
|
|
|
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 };
|
|
2184
|
+
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
2185
|
//# sourceMappingURL=c3-components.mjs.map
|