-
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
Showing
15 changed files
with
258 additions
and
103 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
@mixin dialog() { | ||
.no-padding-dialog .mat-dialog-container { | ||
padding: 0; | ||
|
||
.mat-dialog-content { | ||
margin: 0; | ||
} | ||
} | ||
|
||
.mat-dialog-container { | ||
padding: 0; | ||
|
||
.mat-dialog-content { | ||
margin: 0; | ||
} | ||
|
||
.dialog-toolbar { | ||
display: flex; | ||
justify-content: space-between; | ||
|
||
.dialog-title { | ||
padding: 0 1rem 0 0; | ||
} | ||
|
||
.dialog-action { | ||
display: flex; | ||
justify-content: baseline; | ||
align-items: center; | ||
cursor: pointer; | ||
font-size: 85%; | ||
opacity: 0.9; | ||
} | ||
} | ||
|
||
.dialog-container { | ||
padding: 1rem; | ||
max-height: 65vh; | ||
max-width: 90vw; | ||
overflow: auto; | ||
} | ||
|
||
.dialog-buttons { | ||
display: flex; | ||
justify-content: flex-end; | ||
align-items: center; | ||
padding: 0.7rem; | ||
|
||
.mat-button { | ||
margin: 0 0.5rem; | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { Routes } from '@angular/router'; | ||
|
||
export const appRoutes: Routes = [ | ||
{ path: '', redirectTo: 'overlay', pathMatch: 'full' }, | ||
{ path: '', redirectTo: 'message-box', pathMatch: 'full' }, | ||
{ path: 'overlay', loadComponent: () => import('./overlay/overlay-demo.component').then(m => m.OverlayDemoComponent), data: { title: 'Overlay' } }, | ||
{ path: '**', redirectTo: 'overlay', pathMatch: 'prefix' } | ||
{ path: 'message-box', loadComponent: () => import('./message-box/message-box-demo.component').then(m => m.MessageBoxDemoComponent), data: { title: 'Message Box' } }, | ||
{ path: '**', redirectTo: 'message-box', pathMatch: 'prefix' } | ||
]; |
56 changes: 56 additions & 0 deletions
56
projects/demo-app/src/app/message-box/message-box-demo.component.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,56 @@ | ||
<mat-tab-group [selectedIndex]="tabIndex" (selectedTabChange)="tabIndex = $event.index"> | ||
<mat-tab label="API REFERENCE"></mat-tab> | ||
<mat-tab label="EXAMPLES"></mat-tab> | ||
</mat-tab-group> | ||
|
||
<mat-card class="demo-card demo-basic" *ngIf="tabIndex === 0"> | ||
<!-- <markdown [url]="'https://raw.githubusercontent.com/DSI-HUG/dejajs-components/develop/projects/deja-js/component/message-box/readme.md'"></markdown> --> | ||
</mat-card> | ||
|
||
<div *ngIf="tabIndex === 1" class="example"> | ||
<message-box type="primary" title="Title" [actions]="closeAction"> | ||
Du texte dans la | ||
<b>message box</b> | ||
</message-box> | ||
|
||
<message-box type="primary" title="Title" horizontal [actions]="closeAction"> | ||
Du texte dans la | ||
<b>message box</b> | ||
</message-box> | ||
|
||
<message-box type="warn" horizontal title="Title" [actions]="closeAction"> | ||
Un message "warn" | ||
<b>horizontal</b> | ||
avec titre | ||
</message-box> | ||
|
||
<message-box type="info" horizontal> | ||
Un message "info" | ||
<b>horizontal</b> | ||
</message-box> | ||
|
||
<message-box type="warn" horizontal [actions]="closeAction"> | ||
Un message "warn" | ||
<b>horizontal</b> | ||
</message-box> | ||
|
||
<message-box type="danger" horizontal title="Title"> | ||
Un message "danger" | ||
<b>horizontal</b> | ||
avec une action au format template | ||
<ng-template #actionsTemplate> | ||
<button mat-icon-button> | ||
<mat-icon>clear</mat-icon> | ||
</button> | ||
</ng-template> | ||
</message-box> | ||
|
||
<message-box horizontal>Un message horizontal sans type ni titre</message-box> | ||
|
||
<message-box type="danger" horizontal light [actions]="closeAction">Un message horizontal sans type ni titre</message-box> | ||
<message-box type="success" horizontal light>Un message horizontal sans type ni titre</message-box> | ||
<message-box type="warn" horizontal light>Un message horizontal sans type ni titre</message-box> | ||
<message-box type="info" horizontal light>Un message horizontal sans type ni titre</message-box> | ||
|
||
<button mat-raised-button (click)="openDialog$.next()">Open dialog</button> | ||
</div> |
9 changes: 9 additions & 0 deletions
9
projects/demo-app/src/app/message-box/message-box-demo.component.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,9 @@ | ||
:host { | ||
.example { | ||
margin-top: 2rem; | ||
} | ||
|
||
message-box { | ||
margin-bottom: 1rem; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
projects/demo-app/src/app/message-box/message-box-demo.component.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 @@ | ||
import { NgIf } from '@angular/common'; | ||
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
import { MatCardModule } from '@angular/material/card'; | ||
import { MatIconModule } from '@angular/material/icon'; | ||
import { MatTabsModule } from '@angular/material/tabs'; | ||
import { Destroy } from '@hug/ngx-core'; | ||
import { MessageBoxAction, MessageBoxComponent } from '@hug/ngx-message-box'; | ||
import { MessageBoxDialogButtons, MessageBoxDialogService } from '@hug/ngx-message-box-dialog'; | ||
import { Subject, switchMap, takeUntil } from 'rxjs'; | ||
|
||
@Component({ | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
selector: 'app-message-box-demo', | ||
styleUrls: ['./message-box-demo.component.scss'], | ||
templateUrl: './message-box-demo.component.html', | ||
standalone: true, | ||
imports: [ | ||
MatButtonModule, | ||
MatCardModule, | ||
MatIconModule, | ||
MatTabsModule, | ||
MessageBoxComponent, | ||
NgIf | ||
], | ||
}) | ||
export class MessageBoxDemoComponent extends Destroy { | ||
public tabIndex = 1; | ||
|
||
public closeAction = [ | ||
{ | ||
action: (): void => alert('test action'), | ||
icon: 'clear' | ||
} | ||
] as ReadonlyArray<MessageBoxAction>; | ||
|
||
protected openDialog$ = new Subject<void>(); | ||
|
||
private messageBoxService = inject(MessageBoxDialogService); | ||
|
||
public constructor() { | ||
super(); | ||
|
||
this.openDialog$.pipe( | ||
switchMap(() => { | ||
const dialogData = { | ||
title: 'MessageBox Dialog', | ||
text: 'This is a message box dialog. Click OK or Cancel to close.', | ||
buttons: MessageBoxDialogButtons.OK + MessageBoxDialogButtons.CANCEL, | ||
}; | ||
|
||
return this.messageBoxService.openDialog$(dialogData); | ||
}), | ||
takeUntil(this.destroyed$) | ||
).subscribe(response => { | ||
alert(`${response} was clicked`); | ||
}); | ||
} | ||
} |
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.