-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
559520c
commit 463107b
Showing
18 changed files
with
250 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
modulefederation/apps/web/src/app/portal/applications/application-view.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
modulefederation/libs/portal/src/lib/dialog/dynamic-dialog-builder.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { DialogService } from "./dialogs"; | ||
import { DynamicDialog } from "./dynamic-dialog"; | ||
import { ComponentType } from "@angular/cdk/portal"; | ||
import { AbstractDialogBuilder, AbstractDialogConfig } from "./abstract-dialog-builder"; | ||
|
||
|
||
export interface DynamicDialogConfig extends AbstractDialogConfig { | ||
component: ComponentType<any>, | ||
arguments?: any | ||
} | ||
|
||
|
||
export class DynamicDialogBuilder extends AbstractDialogBuilder<DynamicDialogConfig> { | ||
// constructor | ||
|
||
constructor(dialog : DialogService) { | ||
super(dialog, DynamicDialog, { | ||
title: "", | ||
component: DynamicDialog, | ||
buttons: [] | ||
}) | ||
} | ||
|
||
// fluent | ||
|
||
/** | ||
* set the dialog title | ||
* @param title the title | ||
*/ | ||
component(component : ComponentType<any>) : this { | ||
this.configuration.component = component; | ||
|
||
return this; | ||
} | ||
|
||
/** | ||
* set the dialog arguments | ||
* @param args the arguments | ||
*/ | ||
args(args : any) : this { | ||
this.configuration.arguments = args; | ||
|
||
return this; | ||
} | ||
} | ||
|
14 changes: 14 additions & 0 deletions
14
modulefederation/libs/portal/src/lib/dialog/dynamic-dialog.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<h1 mat-dialog-title>{{data.title}}</h1> | ||
<div class="content" mat-dialog-content> | ||
<ng-container *ngComponentOutlet="data.component"></ng-container> | ||
</div> | ||
<div align="end" mat-dialog-actions> | ||
<button (click)="click(button)" *ngFor="let button of data.buttons" | ||
[color]="button.primary === true ? 'primary' : 'basic'" | ||
[mat-dialog-close]="button.result" | ||
mat-button mat-raised-button> | ||
{{button.label || (button.i18n! | translate)}} | ||
</button> | ||
</div> | ||
|
||
|
1 change: 1 addition & 0 deletions
1
modulefederation/libs/portal/src/lib/dialog/dynamic-dialog.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
59 changes: 59 additions & 0 deletions
59
modulefederation/libs/portal/src/lib/dialog/dynamic-dialog.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
/* eslint-disable @angular-eslint/component-class-suffix */ | ||
import { Component, Inject, OnInit } from "@angular/core"; | ||
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from "@angular/material/dialog"; | ||
import { ButtonConfiguration } from "./dialogs"; | ||
import { MatIconModule } from "@angular/material/icon"; | ||
import { MatButtonModule } from "@angular/material/button"; | ||
import { CommonModule } from "@angular/common"; | ||
import { CommonDialog } from "./dialog-builder"; | ||
import { I18nModule } from "../i18n"; | ||
import { DynamicDialogConfig } from "./dynamic-dialog-builder"; | ||
|
||
@Component({ | ||
selector: 'dynamic-dialog', | ||
templateUrl: './dynamic-dialog.html', | ||
styleUrls: ['./dynamic-dialog.scss'], | ||
standalone: true, | ||
imports: [ | ||
CommonModule, | ||
MatIconModule, | ||
MatDialogModule, | ||
MatButtonModule, | ||
I18nModule | ||
] | ||
}) | ||
export class DynamicDialog extends CommonDialog implements OnInit { | ||
// constructor | ||
|
||
constructor(dialogRef : MatDialogRef<DynamicDialog>, @Inject(MAT_DIALOG_DATA) public data : DynamicDialogConfig) { | ||
super(dialogRef) | ||
} | ||
|
||
// callbacks | ||
|
||
override click(button : ButtonConfiguration) : void { | ||
this.dialogRef.close(button.result); | ||
} | ||
|
||
// implement OnInit | ||
|
||
ngOnInit() : void { | ||
this.data.buttons.forEach(button => this.decorate(button)) | ||
|
||
const button = this.data.buttons.find(button => button.primary) | ||
|
||
if (button) | ||
this.dialogRef.keydownEvents().subscribe(event => { | ||
//if (event.key === "Escape") { | ||
// this.cancel(); | ||
//} | ||
|
||
if (event.key === "Enter" && !event.shiftKey) { | ||
event.preventDefault(); | ||
|
||
this.dialogRef.close(button.result); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.