Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
vapkse committed Jul 26, 2024
2 parents 03b4e26 + f12ab75 commit 5abd5b4
Show file tree
Hide file tree
Showing 14 changed files with 166 additions and 32 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions projects/demo-app/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ <h1 class="demo-app-name">hug/ngx-components Demo</h1>
<span mat-line>Timpe Picker</span>
</mat-list-item>
</mat-nav-list>
<mat-nav-list>
<mat-list-item title="Layout" routerLink="/layout" routerLinkActive="active">
<mat-icon mat-list-icon>dashboard</mat-icon>
<span mat-line>Layout</span>
</mat-list-item>
</mat-nav-list>
</mat-sidenav>

<mat-sidenav-content>
Expand Down
1 change: 1 addition & 0 deletions projects/demo-app/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export const appRoutes: Routes = [
{ path: 'snackbar', loadComponent: () => import('./snackbar/snackbar-demo.component').then(m => m.SnackbarDemoComponent), data: { title: 'Snackbar' } },
{ path: 'splitter', loadComponent: () => import('./splitter/splitter-demo.component').then(m => m.SplitterDemoComponent), data: { title: 'Splitter' } },
{ path: 'time-picker', loadComponent: () => import('./time-picker/time-picker-demo.component').then(m => m.TimePickerDemoComponent), data: { title: 'Time Picker' } },
{ path: 'layout', loadComponent: () => import('./layout/layout-demo.component').then(m => m.LayoutDemoComponent), data: { title: 'Layout' } },
{ path: '**', redirectTo: 'message-box', pathMatch: 'prefix' }
];
44 changes: 44 additions & 0 deletions projects/demo-app/src/app/layout/layout-demo.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<ngx-layout toolbarColor="primary" [withBackButton]="withBackButton" backButtonLabel="Back button label" [withCloseButton]="withCloseButton" (backButtonClicked)="log('Back button clicked', $event)" (closeButtonClicked)="log('Close button clicked', $event)" (sideFilterOpened)="log('Side filter opened')" (sideFilterClosed)="log('Side filter closed')">
<ng-template #layoutToolbar>
<span toolbar-title>Accès dossier patient</span>
<ngx-search-container>
<input type="text" [(ngModel)]="search" (ngModelChange)="log('Search changed', $event)" placeholder="Search" autocomplete="off" ngx-search-input />
</ngx-search-container>

<button type="button" mat-icon-button matTooltip="Help" (click)="log('Help button clicked', $event)">
<mat-icon>help_outline</mat-icon>
</button>
</ng-template>

<!-- Primary action -->
<ng-template #layoutPrimaryAction>
<button type="button" mat-fab matTooltip="Add" (click)="log('Add button clicked', $event)">
<mat-icon>add</mat-icon>
</button>
</ng-template>

<!-- Actions panel -->
<ng-template #layoutActions>
<button type="button" mat-icon-button matTooltip="Refresh" (click)="log('Refresh button clicked', $event)">
<mat-icon>refresh</mat-icon>
</button>

<button type="button" mat-icon-button matTooltip="Favorite" (click)="log('Favorite button clicked', $event)">
<mat-icon>favorite</mat-icon>
</button>
</ng-template>

<!-- Right panel -->
<ng-template #layoutRight>
<div class="layout-right-container">Layout right</div>
</ng-template>

<!-- Info boxes panel -->
<ng-template #layoutInfoBoxes>
<span class="info-box">Info box</span>
<span class="info-box primary">Info box primary</span>
<span class="info-box accent">Info box accent</span>
</ng-template>

<div class="content-container">Layout content</div>
</ngx-layout>
18 changes: 18 additions & 0 deletions projects/demo-app/src/app/layout/layout-demo.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@use '@angular/material' as mat;

:host {
ngx-layout {
.content-container {
display: flex;
flex: 1 1 auto;
padding: 1rem;
background: mat.get-color-from-palette(mat.$green-palette, 100);
}

.layout-right-container {
display: flex;
flex: 1 1 auto;
background: mat.get-color-from-palette(mat.$red-palette, 100);
}
}
}
46 changes: 46 additions & 0 deletions projects/demo-app/src/app/layout/layout-demo.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatTooltipModule } from '@angular/material/tooltip';
import { NgxLayoutComponent } from '@hug/ngx-layout';
import { NgxSearchContainerComponent, NgxSearchInputDirective } from '@hug/ngx-search-container';
import { NgxStatusService } from '@hug/ngx-status';

@Component({
selector: 'app-layout-demo',
templateUrl: './layout-demo.component.html',
styleUrls: ['./layout-demo.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
CommonModule,
FormsModule,
MatButtonModule,
MatIconModule,
MatTooltipModule,
NgxSearchContainerComponent,
NgxSearchInputDirective,
NgxLayoutComponent
]
})
export class LayoutDemoComponent {

protected withBackButton = true;
protected withCloseButton = true;
protected search: string | undefined;

public constructor(
private ngxStatusService: NgxStatusService
) {
}

protected log(msg: string, event?: Event): void {
console.log(msg, event);
this.ngxStatusService.showStatus({
title: msg,
type: 'info'
});
}
}
12 changes: 12 additions & 0 deletions projects/layout/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 1.1.11 (2024-07-26)


### 🐛 Fixes

- **ngx-layout:** remove deprecated/unused input options ([73defb9](https://github.com/DSI-HUG/ngx-components/commit/73defb9))


### ❤️ Thank You

- damien-guillermet

## 1.1.10 (2024-07-25)


Expand Down
2 changes: 1 addition & 1 deletion projects/layout/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hug/ngx-layout",
"version": "1.1.10",
"version": "1.1.11",
"description": "HUG Angular - layout component",
"homepage": "https://github.com/dsi-hug/ngx-components",
"license": "GPL-3.0-only",
Expand Down
24 changes: 2 additions & 22 deletions projects/layout/src/layout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ export class NgxLayoutComponent {
protected mediaService = inject(NgxMediaService);
protected sidenavService = inject(NgxSidenavService);

private _withEditorToolbar = true;

public get layoutToolbar(): TemplateRef<unknown> | undefined {
return this.layoutToolbarExternal ?? this.layoutToolbarContent;
}
Expand All @@ -80,15 +78,6 @@ export class NgxLayoutComponent {
return value;
}

@Input()
public set withEditorToolbar(value: BooleanInput) {
this._withEditorToolbar = coerceBooleanProperty(value);
}

public get withEditorToolbar(): BooleanInput {
return this._withEditorToolbar;
}

private _withSidenav = false;

@Input()
Expand All @@ -101,6 +90,7 @@ export class NgxLayoutComponent {
}

private _keepFilterButtonDisplayed = true;

@Input()
public set keepFilterButtonDisplayed(value: BooleanInput) {
this._keepFilterButtonDisplayed = coerceBooleanProperty(value);
Expand All @@ -111,6 +101,7 @@ export class NgxLayoutComponent {
}

private _withCloseButton = false;

@Input()
public set withCloseButton(value: BooleanInput) {
this._withCloseButton = coerceBooleanProperty(value);
Expand All @@ -131,17 +122,6 @@ export class NgxLayoutComponent {
return this._withBackButton;
}

private _displayEditorToolbar = true;

@Input()
public set displayEditorToolbar(value: BooleanInput) {
this._displayEditorToolbar = coerceBooleanProperty(value);
}

public get displayEditorToolbar(): BooleanInput {
return this._displayEditorToolbar;
}

public closeSideFilter(): void {
void this.sideFilter?.close();
}
Expand Down
15 changes: 15 additions & 0 deletions projects/search-container/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## 1.1.11 (2024-07-26)


### 🐛 Fixes

- error message ([e174fe9](https://github.com/DSI-HUG/ngx-components/commit/e174fe9))

- **ngx-search-container:** add NgTemplateOutlet import + add tooltip and style to icons ([46ae279](https://github.com/DSI-HUG/ngx-components/commit/46ae279))


### ❤️ Thank You

- damien-guillermet
- Serge

## 1.1.10 (2024-07-25)


Expand Down
2 changes: 1 addition & 1 deletion projects/search-container/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hug/ngx-search-container",
"version": "1.1.10",
"version": "1.1.11",
"description": "HUG Angular - search-container component",
"homepage": "https://github.com/dsi-hug/ngx-components",
"license": "GPL-3.0-only",
Expand Down
4 changes: 2 additions & 2 deletions projects/search-container/src/search-container.component.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div *ngIf="mediaService.isHandset$ | async; else noHandsetTpl" class="ngx-search-container-mobile mobile" [class.active]="activeSearch$ | async" #mobileSearch>
<ng-container *ngIf="activeSearch$ | async; else noActiveSearchTpl">
<mat-icon (click)="activeSearch$.next(false)">arrow_back</mat-icon>
<mat-icon class="icon-close-search" [matTooltip]="closeSearchTooltip" (click)="activeSearch$.next(false)">arrow_back</mat-icon>
<ng-container *ngTemplateOutlet="searchContainerTpl"></ng-container>
</ng-container>
<ng-template #noActiveSearchTpl>
<mat-icon (click)="activeSearch$.next(true)">search</mat-icon>
<mat-icon class="icon-open-search" [matTooltip]="openSearchTooltip" (click)="activeSearch$.next(true)">search</mat-icon>
</ng-template>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ngx-search-container {
&.active {
display: flex;
align-items: center;
position: fixed;
position: absolute;
top: 0;
left: 0;
width: 100vw;
Expand All @@ -61,5 +61,10 @@ ngx-search-container {
.mat-icon {
padding: 0.5rem;
}

.icon-close-search,
.icon-open-search {
cursor: pointer;
}
}
}
13 changes: 10 additions & 3 deletions projects/search-container/src/search-container.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AsyncPipe, NgIf } from '@angular/common';
import { AsyncPipe, NgIf, NgTemplateOutlet } from '@angular/common';
import { AfterContentInit, ChangeDetectionStrategy, Component, ContentChild, Directive, ElementRef, EventEmitter, inject, Input, NgZone, Output, TemplateRef, ViewEncapsulation } from '@angular/core';
import { NgControl } from '@angular/forms';
import { MatIconModule } from '@angular/material/icon';
Expand Down Expand Up @@ -34,6 +34,7 @@ export class NgxSearchInputDirective {
imports: [
AsyncPipe,
NgIf,
NgTemplateOutlet,
MatIconModule,
MatTooltipModule
]
Expand All @@ -46,6 +47,12 @@ export class NgxSearchContainerComponent extends NgxDestroy implements AfterCont
@Input()
public clearTooltip = 'Effacer la recherche';

@Input()
public openSearchTooltip = 'Ouvrir la recherche';

@Input()
public closeSearchTooltip = 'Quitter la recherche';

@ContentChild('mobileSearch')
public mobileSearch: TemplateRef<unknown> | undefined;

Expand All @@ -58,10 +65,10 @@ export class NgxSearchContainerComponent extends NgxDestroy implements AfterCont
@ContentChild(NgxSearchInputDirective)
public set searchInput(searchInput: NgxSearchInputDirective) {
if (!searchInput) {
throw new Error('You need to add the attribute ngx-search-input to the SearchContainerComponent');
throw new Error('You need to add the attribute ngx-search-input to the NgxSearchContainerComponent');
}
if (!searchInput.ngControl) {
throw new Error('You need to add the attribute ngModel to the SearchContainerComponent');
throw new Error('You need to add the attribute ngModel to the NgxSearchContainerComponent');
}
this._searchInput = searchInput;
}
Expand Down

0 comments on commit 5abd5b4

Please sign in to comment.