chore(deps): upgrade Angular 19 → 20

- ng update @angular/core@20 @angular/cli@20 @angular/material@20 @angular-eslint@20 @angular/google-maps@20
- Remove ng-chartist (abandoned, incompatible with Angular 20): replace <x-chartist> with <app-bars-chart> in dropzones-bar and jumps-by-month
- Migrate all constructor injection to inject() function (ng generate @angular/core:inject, 67 files)
- TypeScript 5.5 → 5.9.3
- DOCUMENT import moved from @angular/common to @angular/core (automatic migration)
- tsconfig moduleResolution updated to "bundler"
This commit is contained in:
2026-04-26 06:40:13 +02:00
parent 5400294d45
commit be5f5775ef
78 changed files with 5080 additions and 3886 deletions
@@ -1,55 +1,57 @@
import { Directive, AfterContentChecked } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { AccordionLinkDirective } from './accordionlink.directive';
import { filter } from 'rxjs/operators';
@Directive({
selector: '[appAccordion]',
standalone: true
})
export class AccordionDirective implements AfterContentChecked {
protected navlinks: Array<AccordionLinkDirective> = [];
closeOtherLinks(selectedLink: AccordionLinkDirective): void {
this.navlinks.forEach((link: AccordionLinkDirective) => {
if (link !== selectedLink) {
link.selected = false;
}
});
}
addLink(link: AccordionLinkDirective): void {
this.navlinks.push(link);
}
removeGroup(link: AccordionLinkDirective): void {
const index = this.navlinks.indexOf(link);
if (index !== -1) {
this.navlinks.splice(index, 1);
}
}
checkOpenLinks() {
this.navlinks.forEach((link: AccordionLinkDirective) => {
if (link.group) {
const routeUrl = this.router.url;
const currentUrl = routeUrl.split('/');
if (currentUrl.indexOf(link.group) > 0) {
link.selected = true;
this.closeOtherLinks(link);
}
}
});
}
ngAfterContentChecked(): void {
this.router.events
.pipe(filter(event => event instanceof NavigationEnd))
.subscribe(() => this.checkOpenLinks());
}
constructor(private router: Router) {
setTimeout(() => this.checkOpenLinks());
}
}
import { Directive, AfterContentChecked, inject } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { AccordionLinkDirective } from './accordionlink.directive';
import { filter } from 'rxjs/operators';
@Directive({
selector: '[appAccordion]',
standalone: true,
})
export class AccordionDirective implements AfterContentChecked {
private router = inject(Router);
protected navlinks: Array<AccordionLinkDirective> = [];
closeOtherLinks(selectedLink: AccordionLinkDirective): void {
this.navlinks.forEach((link: AccordionLinkDirective) => {
if (link !== selectedLink) {
link.selected = false;
}
});
}
addLink(link: AccordionLinkDirective): void {
this.navlinks.push(link);
}
removeGroup(link: AccordionLinkDirective): void {
const index = this.navlinks.indexOf(link);
if (index !== -1) {
this.navlinks.splice(index, 1);
}
}
checkOpenLinks() {
this.navlinks.forEach((link: AccordionLinkDirective) => {
if (link.group) {
const routeUrl = this.router.url;
const currentUrl = routeUrl.split('/');
if (currentUrl.indexOf(link.group) > 0) {
link.selected = true;
this.closeOtherLinks(link);
}
}
});
}
ngAfterContentChecked(): void {
this.router.events
.pipe(filter((event) => event instanceof NavigationEnd))
.subscribe(() => this.checkOpenLinks());
}
constructor() {
setTimeout(() => this.checkOpenLinks());
}
}
@@ -1,20 +1,22 @@
import { Directive, HostListener, Inject } from '@angular/core';
import { AccordionLinkDirective } from './accordionlink.directive';
@Directive({
selector: '[appAccordionToggle]',
standalone: true
})
export class AccordionAnchorDirective {
protected navlink: AccordionLinkDirective;
constructor(@Inject(AccordionLinkDirective) navlink: AccordionLinkDirective) {
this.navlink = navlink;
}
@HostListener('click', ['$event'])
onClick() {
this.navlink.toggle();
}
}
import { Directive, HostListener, inject } from '@angular/core';
import { AccordionLinkDirective } from './accordionlink.directive';
@Directive({
selector: '[appAccordionToggle]',
standalone: true,
})
export class AccordionAnchorDirective {
protected navlink: AccordionLinkDirective;
constructor() {
const navlink = inject<AccordionLinkDirective>(AccordionLinkDirective);
this.navlink = navlink;
}
@HostListener('click', ['$event'])
onClick() {
this.navlink.toggle();
}
}
@@ -1,51 +1,46 @@
import {
Directive,
HostBinding,
Inject,
Input,
OnInit,
OnDestroy
} from '@angular/core';
import { AccordionDirective } from './accordion.directive';
@Directive({
selector: '[appAccordionLink]',
standalone: true
})
export class AccordionLinkDirective implements OnInit, OnDestroy {
@Input()
public group!: string;
@HostBinding('class.selected')
@Input()
get selected(): boolean {
return this._selected;
}
set selected(value: boolean) {
this._selected = value;
if (value) {
this.nav.closeOtherLinks(this);
}
}
protected _selected: boolean = false;
protected nav: AccordionDirective;
constructor(@Inject(AccordionDirective) nav: AccordionDirective) {
this.nav = nav;
}
ngOnInit() {
this.nav.addLink(this);
}
ngOnDestroy(){
this.nav.removeGroup(this);
}
toggle() {
this.selected = !this.selected;
}
}
import { Directive, HostBinding, Input, OnInit, OnDestroy, inject } from '@angular/core';
import { AccordionDirective } from './accordion.directive';
@Directive({
selector: '[appAccordionLink]',
standalone: true,
})
export class AccordionLinkDirective implements OnInit, OnDestroy {
@Input()
public group!: string;
@HostBinding('class.selected')
@Input()
get selected(): boolean {
return this._selected;
}
set selected(value: boolean) {
this._selected = value;
if (value) {
this.nav.closeOtherLinks(this);
}
}
protected _selected: boolean = false;
protected nav: AccordionDirective;
constructor() {
const nav = inject<AccordionDirective>(AccordionDirective);
this.nav = nav;
}
ngOnInit() {
this.nav.addLink(this);
}
ngOnDestroy() {
this.nav.removeGroup(this);
}
toggle() {
this.selected = !this.selected;
}
}
@@ -29,6 +29,10 @@ import { AeronefByImat, AeronefByYear } from '@models';
templateUrl: './aeronefs-bar.component.html',
})
export class AeronefsBarComponent implements OnInit, OnDestroy {
private _aeronefsService = inject(AeronefsService);
private _utilitiesService = inject(UtilitiesService);
menuItems = inject(MenuItems);
private _aeronefByImat: Subscription = new Subscription();
private _aeronefByYear: Subscription = new Subscription();
private _aeronefsByImat!: Array<AeronefByImat>;
@@ -50,12 +54,6 @@ export class AeronefsBarComponent implements OnInit, OnDestroy {
public displayCharts = false;
public destroyRef = inject(DestroyRef);
constructor(
private _aeronefsService: AeronefsService,
private _utilitiesService: UtilitiesService,
public menuItems: MenuItems,
) {}
ngOnInit() {
this._loadAeronefByImat();
}
@@ -31,6 +31,10 @@ import { AeronefByImat, AeronefByYear } from '@models';
templateUrl: './aeronefs-pie.component.html',
})
export class AeronefsPieComponent implements OnInit, OnDestroy {
private _aeronefsService = inject(AeronefsService);
private _utilitiesService = inject(UtilitiesService);
menuItems = inject(MenuItems);
private _aeronefByImat: Subscription = new Subscription();
private _aeronefByYear: Subscription = new Subscription();
private _aeronefsByImat!: Array<AeronefByImat>;
@@ -51,12 +55,6 @@ export class AeronefsPieComponent implements OnInit, OnDestroy {
public seriesColorClass: string[] = this._utilitiesService.getChartColors();
public destroyRef = inject(DestroyRef);
constructor(
private _aeronefsService: AeronefsService,
private _utilitiesService: UtilitiesService,
public menuItems: MenuItems,
) {}
ngOnInit() {
this._loadAeronefByImat();
}
@@ -29,6 +29,10 @@ import { CanopyModelBySize, CanopyModelByYear } from '@models';
templateUrl: './canopies-models.component.html',
})
export class CanopiesModelsComponent implements OnInit, OnDestroy {
private _canopiesService = inject(CanopiesService);
private _utilitiesService = inject(UtilitiesService);
menuItems = inject(MenuItems);
private _canopyBySize: Subscription = new Subscription();
private _canopyByYear: Subscription = new Subscription();
private _canopiesBySize!: Array<CanopyModelBySize>;
@@ -49,12 +53,6 @@ export class CanopiesModelsComponent implements OnInit, OnDestroy {
public seriesColorClass: string[] = this._utilitiesService.getChartColors();
public destroyRef = inject(DestroyRef);
constructor(
private _canopiesService: CanopiesService,
private _utilitiesService: UtilitiesService,
public menuItems: MenuItems,
) {}
ngOnInit() {
this._loadCanopyModelBySize();
}
@@ -30,6 +30,10 @@ import { CanopyBySize, CanopyByYear } from '@models';
templateUrl: './canopies-sizes.component.html',
})
export class CanopiesSizesComponent implements OnInit, OnDestroy {
private _canopiesService = inject(CanopiesService);
private _utilitiesService = inject(UtilitiesService);
menuItems = inject(MenuItems);
private _canopyBySize: Subscription = new Subscription();
private _canopyByYear: Subscription = new Subscription();
private _canopiesBySize!: Array<CanopyBySize>;
@@ -50,12 +54,6 @@ export class CanopiesSizesComponent implements OnInit, OnDestroy {
public seriesColorClass: string[] = this._utilitiesService.getChartColors();
public destroyRef = inject(DestroyRef);
constructor(
private _canopiesService: CanopiesService,
private _utilitiesService: UtilitiesService,
public menuItems: MenuItems,
) {}
ngOnInit() {
this._loadCanopyBySize();
}
@@ -8,19 +8,22 @@
</button>
<mat-menu #menuDropzoneBar="matMenu">
@for (menuitem of menuItems.getMenuPanel(); track menuitem) {
<button mat-menu-item>
<mat-icon [fontIcon]="menuitem.icon"></mat-icon>
<span>{{ menuitem.name }}</span>
</button>
<button mat-menu-item>
<mat-icon [fontIcon]="menuitem.icon"></mat-icon>
<span>{{ menuitem.name }}</span>
</button>
}
</mat-menu>
</mat-card-header>
<mat-divider class="my-3"></mat-divider>
<mat-card-content>
@if (displayCharts) {
<div class="barchart position-relative w-100 my-1">
<x-chartist [configuration]="barChartDropZones"></x-chartist>
</div>
<app-bars-chart
[names]="seriesName"
[values]="seriesRow"
[headers]="seriesHeader"
[colors]="seriesColor"
></app-bars-chart>
}
</mat-card-content>
<mat-divider class="mt-3 mb-0"></mat-divider>
@@ -29,7 +32,13 @@
<mat-expansion-panel-header>
<mat-panel-title>Historique annuel</mat-panel-title>
</mat-expansion-panel-header>
<app-history-table [headers]="seriesHeader" [names]="seriesName" [values]="seriesValue" [rows]="seriesRow" [colors]="seriesColorClass"></app-history-table>
<app-history-table
[headers]="seriesHeader"
[names]="seriesName"
[values]="seriesValue"
[rows]="seriesRow"
[colors]="seriesColorClass"
></app-history-table>
</mat-expansion-panel>
</mat-accordion>
</mat-card>
@@ -6,12 +6,10 @@ import { MatDividerModule } from '@angular/material/divider';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
import { BaseChartDirective } from 'ng2-charts';
import { ChartistModule, Configuration } from 'ng-chartist';
import { AxisOptions, Label } from 'chartist';
import { Observable, Subscription } from 'rxjs';
import { MenuItems } from '@components/shared';
import { BarsChartComponent } from '@components/shared/helpers-chart';
import { HistoryTableComponent } from '@components/shared/helpers-jump';
import { UtilitiesService, DropZonesService } from '@services';
import { DropZoneByOaci, DropZoneByYear } from '@models';
@@ -25,13 +23,16 @@ import { DropZoneByOaci, DropZoneByYear } from '@models';
MatExpansionModule,
MatIconModule,
MatMenuModule,
BaseChartDirective,
ChartistModule,
BarsChartComponent,
HistoryTableComponent,
],
templateUrl: './dropzones-bar.component.html',
})
export class DropzonesBarComponent implements OnInit, OnDestroy {
private _dropzonesService = inject(DropZonesService);
private _utilitiesService = inject(UtilitiesService);
menuItems = inject(MenuItems);
private _dropzoneByOaci: Subscription = new Subscription();
private _dropzoneByYear: Subscription = new Subscription();
private _dropzonesByOaci!: Array<DropZoneByOaci>;
@@ -51,15 +52,8 @@ export class DropzonesBarComponent implements OnInit, OnDestroy {
};
public seriesColorClass: string[] = this._utilitiesService.getChartColors();
public displayCharts = false;
public barChartDropZones: Configuration = this._utilitiesService.getBarConfig();
public destroyRef = inject(DestroyRef);
constructor(
private _dropzonesService: DropZonesService,
private _utilitiesService: UtilitiesService,
public menuItems: MenuItems,
) {}
ngOnInit() {
this._loadDropZoneByOaci();
}
@@ -101,60 +95,6 @@ export class DropzonesBarComponent implements OnInit, OnDestroy {
row.count;
return row;
});
const axisX: AxisOptions = {
labelInterpolationFnc: function (value: Label, index: number): string {
return index % 1 === 0 ? `${value.toString()}` : '';
},
};
this.barChartDropZones = {
type: 'Bar',
data: {
labels: this.seriesHeader,
series: this.seriesRow,
},
options: {
seriesBarDistance: 15,
horizontalBars: false,
high: 180,
axisX: {
showGrid: false,
offset: 20,
},
axisY: {
showGrid: true,
offset: 40,
},
height: 300,
},
responsiveOptions: [
[
'screen and (min-width: 1024px)',
{
axisX: axisX,
},
],
[
'screen and (min-width: 641px) and (max-width: 1024px)',
{
seriesBarDistance: 7,
axisY: {
offset: 30,
},
axisX: axisX,
},
],
[
'screen and (max-width: 640px)',
{
seriesBarDistance: 5,
axisY: {
offset: 20,
},
axisX: axisX,
},
],
],
};
this.displayCharts = true;
});
}
@@ -30,6 +30,10 @@ import { DropZoneByOaci, DropZoneByYear } from '@models';
templateUrl: './dropzones-pie.component.html',
})
export class DropzonesPieComponent implements OnInit, OnDestroy {
private _dropzonesService = inject(DropZonesService);
private _utilitiesService = inject(UtilitiesService);
menuItems = inject(MenuItems);
private _dropzoneByOaci: Subscription = new Subscription();
private _dropzoneByYear: Subscription = new Subscription();
private _dropzonesByOaci!: Array<DropZoneByOaci>;
@@ -50,12 +54,6 @@ export class DropzonesPieComponent implements OnInit, OnDestroy {
public seriesColorClass: string[] = this._utilitiesService.getChartColors();
public destroyRef = inject(DestroyRef);
constructor(
private _dropzonesService: DropZonesService,
private _utilitiesService: UtilitiesService,
public menuItems: MenuItems,
) {}
ngOnInit() {
this._loadDropZoneByOaci();
}
@@ -1,86 +1,88 @@
<mat-card>
<mat-card-header>
<mat-card-title>{{ title }}</mat-card-title>
<mat-card-subtitle>{{ subtitle }} de {{min}} à {{max}}</mat-card-subtitle>
<span class="flex-spacer"></span>
<button mat-icon-button [matMenuTriggerFor]="menuJumpBar" aria-label="Menu Dropzone Bar">
<mat-icon fontIcon="more_vert"></mat-icon>
</button>
<mat-menu #menuJumpBar="matMenu">
<button mat-menu-item *ngFor="let menuitem of menuItems.getMenuPanel()">
<mat-icon [fontIcon]="menuitem.icon"></mat-icon>
<span>{{ menuitem.name }}</span>
</button>
</mat-menu>
</mat-card-header>
<mat-divider class="my-3"></mat-divider>
<mat-card-content>
<!--
<div class="text-center mb-3">
<ul class="list-inline my-0">
<li *ngFor='let name of seriesName; let i=index' class="list-inline-item me-lg-3 me-sm-2">
<span class="{{seriesColor[i]}} fs-6 m-0">
● {{name}}
</span>
</li>
</ul>
</div>
-->
<div *ngIf="displayCharts" class="barchart position-relative w-100 my-1">
<x-chartist [configuration]="barChartJumps"></x-chartist>
</div>
</mat-card-content>
<mat-divider class="mt-3 mb-0"></mat-divider>
<mat-accordion>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>Historique annuel</mat-panel-title>
</mat-expansion-panel-header>
<table class="table table-striped table-dark table-hover">
<thead>
<tr>
<th></th>
<th *ngFor='let name of seriesHeader; let i=index' class="text-end"> {{ name }} </th>
<th class="text-end">Total</th>
</tr>
</thead>
<tbody>
<tr *ngFor='let values of seriesRow; let i=index'>
<th class="{{seriesColorClass[i]}} text-end"> ● {{ seriesName[i] }} </th>
<td *ngFor='let value of values; let i=index' class="font-monospace text-end">
<span *ngIf="value; else elseBlock" class="pr-1">{{ value }}</span>
<ng-template #elseBlock><span class="text-empty pr-1">{{ value }}</span></ng-template>
</td>
<th class="{{seriesColorClass[i]}} font-monospace text-end">{{ seriesRowTotal[i] }}</th>
</tr>
</tbody>
<tfoot>
<tr>
<th class="text-end">Total</th>
<th *ngFor='let value of seriesColTotal; let i=index' class="font-monospace text-end">
<span *ngIf="value; else elseBlock" class="pr-1">{{ value }}</span>
<ng-template #elseBlock><span class="text-empty pr-1">{{ value }}</span></ng-template>
</th>
<th class="font-monospace text-end">{{ grandTotal }}</th>
</tr>
<tr>
<th class="text-end">Moyenne</th>
<th *ngFor='let value of seriesRowAvg; let i=index' class="font-monospace text-end">
<span *ngIf="value; else elseBlock" class="pr-1">{{ value | number : '1.0-1' }}</span>
<ng-template #elseBlock><span class="text-empty pr-1">{{ value | number : '1.0-1' }}</span></ng-template>
</th>
<th class="font-monospace text-end">{{ grandAvg | number : '1.0-1' }}</th>
</tr>
<tr>
<th class="text-end">Moyenne <small>3 dernières années</small></th>
<th *ngFor='let value of seriesRowAvgLastYears; let i=index' class="font-monospace text-end">
<span *ngIf="value; else elseBlock" class="pr-1">{{ value | number : '1.0-1' }}</span>
<ng-template #elseBlock><span class="text-empty pr-1">{{ value | number : '1.0-1' }}</span></ng-template>
</th>
<th class="font-monospace text-end">{{ grandAvgLastYears | number : '1.0-1' }}</th>
</tr>
</tfoot>
</table>
</mat-expansion-panel>
</mat-accordion>
</mat-card>
<mat-card>
<mat-card-header>
<mat-card-title>{{ title }}</mat-card-title>
<mat-card-subtitle>{{ subtitle }} de {{ min }} à {{ max }}</mat-card-subtitle>
<span class="flex-spacer"></span>
<button mat-icon-button [matMenuTriggerFor]="menuJumpBar" aria-label="Menu Dropzone Bar">
<mat-icon fontIcon="more_vert"></mat-icon>
</button>
<mat-menu #menuJumpBar="matMenu">
<button mat-menu-item *ngFor="let menuitem of menuItems.getMenuPanel()">
<mat-icon [fontIcon]="menuitem.icon"></mat-icon>
<span>{{ menuitem.name }}</span>
</button>
</mat-menu>
</mat-card-header>
<mat-divider class="my-3"></mat-divider>
<mat-card-content>
@if (displayCharts) {
<app-bars-chart
[names]="seriesName"
[values]="seriesRow"
[headers]="seriesHeader"
[colors]="seriesColor"
></app-bars-chart>
}
</mat-card-content>
<mat-divider class="mt-3 mb-0"></mat-divider>
<mat-accordion>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>Historique annuel</mat-panel-title>
</mat-expansion-panel-header>
<table class="table table-striped table-dark table-hover">
<thead>
<tr>
<th></th>
<th *ngFor="let name of seriesHeader; let i = index" class="text-end">{{ name }}</th>
<th class="text-end">Total</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let values of seriesRow; let i = index">
<th class="{{ seriesColorClass[i] }} text-end"> {{ seriesName[i] }}</th>
<td *ngFor="let value of values; let i = index" class="font-monospace text-end">
<span *ngIf="value; else elseBlock" class="pr-1">{{ value }}</span>
<ng-template #elseBlock
><span class="text-empty pr-1">{{ value }}</span></ng-template
>
</td>
<th class="{{ seriesColorClass[i] }} font-monospace text-end">{{ seriesRowTotal[i] }}</th>
</tr>
</tbody>
<tfoot>
<tr>
<th class="text-end">Total</th>
<th *ngFor="let value of seriesColTotal; let i = index" class="font-monospace text-end">
<span *ngIf="value; else elseBlock" class="pr-1">{{ value }}</span>
<ng-template #elseBlock
><span class="text-empty pr-1">{{ value }}</span></ng-template
>
</th>
<th class="font-monospace text-end">{{ grandTotal }}</th>
</tr>
<tr>
<th class="text-end">Moyenne</th>
<th *ngFor="let value of seriesRowAvg; let i = index" class="font-monospace text-end">
<span *ngIf="value; else elseBlock" class="pr-1">{{ value | number: "1.0-1" }}</span>
<ng-template #elseBlock
><span class="text-empty pr-1">{{ value | number: "1.0-1" }}</span></ng-template
>
</th>
<th class="font-monospace text-end">{{ grandAvg | number: "1.0-1" }}</th>
</tr>
<tr>
<th class="text-end">Moyenne <small>3 dernières années</small></th>
<th *ngFor="let value of seriesRowAvgLastYears; let i = index" class="font-monospace text-end">
<span *ngIf="value; else elseBlock" class="pr-1">{{ value | number: "1.0-1" }}</span>
<ng-template #elseBlock
><span class="text-empty pr-1">{{ value | number: "1.0-1" }}</span></ng-template
>
</th>
<th class="font-monospace text-end">{{ grandAvgLastYears | number: "1.0-1" }}</th>
</tr>
</tfoot>
</table>
</mat-expansion-panel>
</mat-accordion>
</mat-card>
@@ -1,36 +1,40 @@
import { Component, DestroyRef, inject, OnInit, OnDestroy } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { CommonModule } from '@angular/common';
import { NgFor, NgIf, DecimalPipe } from '@angular/common';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatDividerModule } from '@angular/material/divider';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
import { ChartistModule, Configuration } from 'ng-chartist';
import { AxisOptions, Label } from 'chartist';
import { Observable, Subscription } from 'rxjs';
import { MenuItems } from '@components/shared';
import { BarsChartComponent } from '@components/shared/helpers-chart';
import { UtilitiesService, JumpsService } from '@services';
import { JumpByDate } from '@models';
@Component({
selector: 'app-jumps-by-month',
imports: [
CommonModule,
NgFor,
NgIf,
DecimalPipe,
MatButtonModule,
MatCardModule,
MatDividerModule,
MatExpansionModule,
MatIconModule,
MatMenuModule,
ChartistModule,
BarsChartComponent,
],
templateUrl: './jumps-by-month.component.html',
})
export class JumpsByMonthComponent implements OnInit, OnDestroy {
private _jumpsService = inject(JumpsService);
private _utilitiesService = inject(UtilitiesService);
menuItems = inject(MenuItems);
private _jumpByDate: Subscription = new Subscription();
private _jumpsByDate!: Array<JumpByDate>;
private _jumpsByDateCount = 0;
@@ -59,15 +63,8 @@ export class JumpsByMonthComponent implements OnInit, OnDestroy {
public seriesColTotalClosed: number[] = [];
public seriesColTotalLastYears: number[] = [];
public displayCharts = false;
public barChartJumps: Configuration = this._utilitiesService.getBarConfig();
public destroyRef = inject(DestroyRef);
constructor(
private _jumpsService: JumpsService,
private _utilitiesService: UtilitiesService,
public menuItems: MenuItems,
) {}
ngOnInit() {
this._loadJumpByDate();
}
@@ -130,59 +127,6 @@ export class JumpsByMonthComponent implements OnInit, OnDestroy {
0,
);
this.grandTotal = this.seriesColTotal.reduce((partialSum, accumulated) => partialSum + accumulated, 0);
const axisX: AxisOptions = {
labelInterpolationFnc: function (value: Label, index: number): string {
return index % 1 === 0 ? `${value.toString()}` : '';
},
};
this.barChartJumps = {
type: 'Bar',
data: {
labels: this.seriesHeader,
series: this.seriesRow,
},
options: {
seriesBarDistance: 15,
high: 70,
axisX: {
showGrid: false,
offset: 20,
},
axisY: {
showGrid: true,
offset: 40,
},
height: 300,
},
responsiveOptions: [
[
'screen and (min-width: 1024px)',
{
axisX: axisX,
},
],
[
'screen and (min-width: 641px) and (max-width: 1024px)',
{
seriesBarDistance: 10,
axisY: {
offset: 30,
},
axisX: axisX,
},
],
[
'screen and (max-width: 640px)',
{
seriesBarDistance: 5,
axisY: {
offset: 20,
},
axisX: axisX,
},
],
],
};
this.displayCharts = true;
});
}
@@ -1,4 +1,4 @@
import { Component, Input, OnChanges } from '@angular/core';
import { Component, Input, OnChanges, inject } from '@angular/core';
import { ChartDataset } from 'chart.js';
import { BaseChartDirective } from 'ng2-charts';
@@ -11,11 +11,11 @@ import { BarConfig } from '@models';
templateUrl: './bar-chart.component.html',
})
export class BarChartComponent implements OnChanges {
private _utilitiesService = inject(UtilitiesService);
public displayCharts = false;
public chartConfig: BarConfig = this._utilitiesService.getBarChartConfig();
constructor(private _utilitiesService: UtilitiesService) {}
@Input() names: string[] = [];
@Input() values: number[] = [];
@Input() headers: string[] = [];
@@ -1,4 +1,4 @@
import { Component, Input, OnChanges } from '@angular/core';
import { Component, Input, OnChanges, inject } from '@angular/core';
import { ChartDataset } from 'chart.js';
import { BaseChartDirective } from 'ng2-charts';
@@ -11,11 +11,11 @@ import { BarConfig } from '@models';
templateUrl: './bar-horizontal-chart.component.html',
})
export class BarHorizontalChartComponent implements OnChanges {
private _utilitiesService = inject(UtilitiesService);
public displayCharts = false;
public chartConfig: BarConfig = this._utilitiesService.getHorizontalBarChartConfig();
constructor(private _utilitiesService: UtilitiesService) {}
@Input() names: string[] = [];
@Input() values: number[] = [];
@Input() headers: string[] = [];
@@ -1,4 +1,4 @@
import { Component, Input, OnChanges, AfterContentChecked } from '@angular/core';
import { Component, Input, OnChanges, AfterContentChecked, inject } from '@angular/core';
import { ChartDataset } from 'chart.js';
import { BaseChartDirective } from 'ng2-charts';
@@ -11,11 +11,11 @@ import { BarConfig } from '@models';
templateUrl: './bars-chart.component.html',
})
export class BarsChartComponent implements OnChanges, AfterContentChecked {
private _utilitiesService = inject(UtilitiesService);
public displayCharts = false;
public chartConfig: BarConfig = this._utilitiesService.getBarChartConfig();
constructor(private _utilitiesService: UtilitiesService) {}
@Input() names: string[] = [];
@Input() values: Array<Array<number>> = [];
@Input() headers: string[] = [];
@@ -1,4 +1,4 @@
import { Component, Input, OnChanges } from '@angular/core';
import { Component, Input, OnChanges, inject } from '@angular/core';
//import { ChartDataset } from 'chart.js';
import { BaseChartDirective } from 'ng2-charts';
@@ -11,11 +11,11 @@ import { CircleConfig } from '@models';
templateUrl: './circle-chart.component.html',
})
export class CircleChartComponent implements OnChanges {
private _utilitiesService = inject(UtilitiesService);
public displayCharts = false;
public chartConfig: CircleConfig = this._utilitiesService.getCircleChartConfig();
constructor(private _utilitiesService: UtilitiesService) {}
@Input() names: string[] = [];
@Input() values: number[] = [];
@Input() headers: string[] = [];
@@ -1,4 +1,4 @@
import { Component, Input, OnChanges } from '@angular/core';
import { Component, Input, OnChanges, inject } from '@angular/core';
import { ChartDataset, Point } from 'chart.js';
import { BaseChartDirective } from 'ng2-charts';
@@ -11,11 +11,11 @@ import { LineConfig } from '@models';
templateUrl: './line-chart.component.html',
})
export class LineChartComponent implements OnChanges {
private _utilitiesService = inject(UtilitiesService);
public displayCharts = false;
public chartConfig: LineConfig = this._utilitiesService.getLineChartConfig();
constructor(private _utilitiesService: UtilitiesService) {}
@Input() headers: string[] = [];
@Input() names: string[] = [];
@Input() values: Array<Array<number>> = [];
@@ -1,4 +1,4 @@
import { Component, Input, OnChanges } from '@angular/core';
import { Component, Input, OnChanges, inject } from '@angular/core';
import { ChartDataset } from 'chart.js';
import { BaseChartDirective } from 'ng2-charts';
@@ -11,11 +11,11 @@ import { LineConfig } from '@models';
templateUrl: './linearea-chart.component.html',
})
export class LineAreaChartComponent implements OnChanges {
private _utilitiesService = inject(UtilitiesService);
public displayCharts = false;
public chartConfig: LineConfig = this._utilitiesService.getStackedLineAreaChartConfig();
constructor(private _utilitiesService: UtilitiesService) {}
@Input() headers: string[] = [];
@Input() names: string[] = [];
@Input() values: Array<Array<number>> = [];
@@ -1,4 +1,4 @@
import { Component, Input, OnChanges } from '@angular/core';
import { Component, Input, OnChanges, inject } from '@angular/core';
//import { ChartDataset } from 'chart.js';
import { BaseChartDirective } from 'ng2-charts';
@@ -11,11 +11,11 @@ import { DoughnutConfig } from '@models';
templateUrl: './pie-chart.component.html',
})
export class PieChartComponent implements OnChanges {
private _utilitiesService = inject(UtilitiesService);
public displayCharts = false;
public chartConfig: DoughnutConfig = this._utilitiesService.getDoughnutChartConfig();
constructor(private _utilitiesService: UtilitiesService) {}
@Input() names: string[] = [];
@Input() values: number[] = [];
@Input() headers: string[] = [];
@@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy, Input } from '@angular/core';
import { Component, OnInit, OnDestroy, Input, inject } from '@angular/core';
import { NgClass, DatePipe } from '@angular/common';
import { RouterLink } from '@angular/router';
import { MatButtonModule } from '@angular/material/button';
@@ -24,6 +24,8 @@ import { JumpPreviewComponent } from './jump-preview.component';
],
})
export class JumpListComponent implements OnInit, OnDestroy {
private jumpsService = inject(JumpsService);
private _jumps: Subscription = new Subscription();
errors: Errors = { errors: {} };
query!: JumpListConfig;
@@ -34,8 +36,6 @@ export class JumpListComponent implements OnInit, OnDestroy {
pages: Array<number> = [1];
lastUpdate: Date = new Date();
constructor(private jumpsService: JumpsService) {}
@Input() limit = 0;
@Input() refresh = 30000;
@Input() title = '';
@@ -1,4 +1,4 @@
import { Component, OnDestroy, Input } from '@angular/core';
import { Component, OnDestroy, Input, inject } from '@angular/core';
import { DecimalPipe } from '@angular/common';
import { Router, RouterLink } from '@angular/router';
import { MatButtonModule } from '@angular/material/button';
@@ -17,17 +17,15 @@ import { JumpsService } from '@services';
templateUrl: './jump-preview.component.html',
})
export class JumpPreviewComponent implements OnDestroy {
private router = inject(Router);
private jumpsService = inject(JumpsService);
@Input() jump!: Jump;
@Input() isUser!: boolean;
@Input() showMeta!: boolean;
private _jump: Subscription = new Subscription();
isDeleting = false;
constructor(
private router: Router,
private jumpsService: JumpsService,
) {}
ngOnDestroy() {
this._jump.unsubscribe();
}
@@ -7,6 +7,7 @@ import {
OnChanges,
OnDestroy,
ViewChild,
inject,
} from '@angular/core';
import { CommonModule, DecimalPipe, DatePipe } from '@angular/common';
import { UntypedFormBuilder, UntypedFormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
@@ -88,6 +89,13 @@ import {
providers: [{ provide: MatPaginatorIntl, useClass: FrenchPaginator }],
})
export class JumpTableComponent implements OnChanges, OnDestroy, AfterContentChecked {
private router = inject(Router);
private _jumpsService = inject(JumpsService);
private _jumpTableService = inject(JumpTableService);
private dialog = inject(MatDialog);
private fb = inject(UntypedFormBuilder);
private snackBar = inject(MatSnackBar);
private _jumps: Subscription = new Subscription();
private _subscriptions: Array<Subscription> = [];
//private _jump: Subscription = new Subscription();
@@ -131,14 +139,7 @@ export class JumpTableComponent implements OnChanges, OnDestroy, AfterContentChe
@ViewChild(MatSort) sort!: MatSort;
@ViewChild(MatPaginator) paginator!: MatPaginator;
constructor(
private router: Router,
private _jumpsService: JumpsService,
private _jumpTableService: JumpTableService,
private dialog: MatDialog,
private fb: UntypedFormBuilder,
private snackBar: MatSnackBar,
) {
constructor() {
this._resetErrors();
this.searchForm = this.fb.group({
//numero: ['', Validators.required]
@@ -3,11 +3,11 @@
display: inline-block;
}
.mat-mdc-standard-chip {
--mdc-chip-container-height: 28px;
--mdc-chip-container-shape-radius: 8px 8px 8px 8px;
--mdc-chip-label-text-color: inherit;
--mdc-chip-label-text-line-height: 20px;
--mdc-chip-label-text-size: 13px;
--mdc-chip-label-text-weight: 400;
--mdc-chip-with-avatar-avatar-shape-radius: 6px 6px 6px 6px;
}
--mat-chip-container-height: 28px;
--mat-chip-container-shape-radius: 8px 8px 8px 8px;
--mat-chip-label-text-color: inherit;
--mat-chip-label-text-line-height: 20px;
--mat-chip-label-text-size: 13px;
--mat-chip-label-text-weight: 400;
--mat-chip-with-avatar-avatar-shape-radius: 6px 6px 6px 6px;
}
@@ -48,6 +48,8 @@ export class StepperIntl extends MatStepperIntl {
styleUrl: './guildraids-log.component.scss',
})
export class GuildraidsLogComponent implements OnInit {
private fb = inject(FormBuilder);
public now: Date;
public raidsForm: FormGroup;
public guildMembers: HWMember[] = [];
@@ -66,7 +68,7 @@ export class GuildraidsLogComponent implements OnInit {
this.guildMembers = value;
}
constructor(private fb: FormBuilder) {
constructor() {
this.now = new Date();
const raidsDate = new Date();
const startHour = 4;
@@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input, OnInit, inject } from '@angular/core';
import { DatePipe, DecimalPipe } from '@angular/common';
import { MatCardModule } from '@angular/material/card';
import { MatDividerModule } from '@angular/material/divider';
@@ -17,6 +17,8 @@ import guildStatistics from 'src/files-data/hw-guild-statistics.json'; // page O
styleUrl: './members-statistics.component.scss',
})
export class MembersStatisticsComponent implements OnInit {
private _utilitiesService = inject(UtilitiesService);
public guildMembers: HWMember[] = [];
public title = 'Members';
public subtitle = 'statistics';
@@ -82,8 +84,6 @@ export class MembersStatisticsComponent implements OnInit {
this.guildMembers = value;
}
constructor(private _utilitiesService: UtilitiesService) {}
ngOnInit() {
const oneDayInSec = 24 * 60 * 60;
const today = new Date();
@@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';
import { Component, OnInit, OnDestroy, ChangeDetectorRef, inject } from '@angular/core';
import { Router, RouterOutlet, RouterModule } from '@angular/router';
import { MediaMatcher } from '@angular/cdk/layout';
import { MatBadgeModule } from '@angular/material/badge';
@@ -51,6 +51,10 @@ import { FooterComponent } from '@components/shared/layout';
styleUrls: [],
})
export class FullComponent implements OnInit, OnDestroy {
private router = inject(Router);
private userService = inject(UserService);
menuItems = inject(MenuItems);
private _currentUser: Subscription = new Subscription();
private _mobileQueryListener: () => void;
mobileQuery: MediaQueryList;
@@ -63,13 +67,10 @@ export class FullComponent implements OnInit, OnDestroy {
//visibleMenu: string[] = ['products', 'page'];
//visibleMenu: string[] = ['products'];
constructor(
private router: Router,
private userService: UserService,
changeDetectorRef: ChangeDetectorRef,
media: MediaMatcher,
public menuItems: MenuItems,
) {
constructor() {
const changeDetectorRef = inject(ChangeDetectorRef);
const media = inject(MediaMatcher);
this.mobileQuery = media.matchMedia('(min-width: 768px)');
this._mobileQueryListener = () => changeDetectorRef.detectChanges();
this.mobileQuery.addListener(this._mobileQueryListener);
@@ -26,17 +26,15 @@ import { UserService } from '@services';
],
})
export class HeaderComponent implements OnInit {
private router = inject(Router);
private userService = inject(UserService);
private _currentUser: Subscription = new Subscription();
private _isAuthenticated: Subscription = new Subscription();
private isAuthenticated = false;
currentUser: User = {} as User;
destroyRef = inject(DestroyRef);
constructor(
private router: Router,
private userService: UserService,
) {}
ngOnInit() {
const user$: Observable<User> = this.userService.currentUser.pipe(takeUntilDestroyed(this.destroyRef));
this._currentUser = user$.subscribe((userData) => {
@@ -1,21 +1,18 @@
import { Directive, Input, OnInit, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
import { Directive, Input, OnInit, OnDestroy, TemplateRef, ViewContainerRef, inject } from '@angular/core';
import { Observable, Subscription } from 'rxjs';
import { UserService } from '@services';
@Directive({
selector: '[appShowAuthed]',
standalone: true
standalone: true,
})
export class ShowAuthedDirective implements OnInit, OnDestroy {
private _auth: Subscription = new Subscription();
private templateRef = inject<TemplateRef<never>>(TemplateRef);
private userService = inject(UserService);
private viewContainer = inject(ViewContainerRef);
constructor(
//private templateRef: TemplateRef<any>,
private templateRef: TemplateRef<never>,
private userService: UserService,
private viewContainer: ViewContainerRef
) { }
private _auth: Subscription = new Subscription();
@Input() set appShowAuthed(condition: boolean) {
this.condition = condition;
@@ -25,21 +22,17 @@ export class ShowAuthedDirective implements OnInit, OnDestroy {
//condition: boolean;
ngOnInit() {
const isAuthenticated$: Observable<boolean> = this.userService.isAuthenticated; // .pipe(take(1));
this._auth = isAuthenticated$.subscribe(
(isAuthenticated) => {
if (isAuthenticated && this.condition || !isAuthenticated && !this.condition) {
this.viewContainer.createEmbeddedView(this.templateRef);
} else {
this.viewContainer.clear();
}
this._auth = isAuthenticated$.subscribe((isAuthenticated) => {
if ((isAuthenticated && this.condition) || (!isAuthenticated && !this.condition)) {
this.viewContainer.createEmbeddedView(this.templateRef);
} else {
this.viewContainer.clear();
}
);
});
}
ngOnDestroy() {
this._auth.unsubscribe();
}
}
@@ -1,7 +1,6 @@
import { Component, Input, OnDestroy, Inject, ViewEncapsulation } from '@angular/core';
import { Component, Input, OnDestroy, ViewEncapsulation, DOCUMENT, inject } from '@angular/core';
import { Router, NavigationStart, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router';
import { DOCUMENT } from '@angular/common';
@Component({
selector: 'app-spinner',
@@ -10,15 +9,15 @@ import { DOCUMENT } from '@angular/common';
encapsulation: ViewEncapsulation.None,
})
export class SpinnerComponent implements OnDestroy {
private router = inject(Router);
private document = inject<Document>(DOCUMENT);
public isSpinnerVisible = true;
@Input()
public backgroundColor = 'rgba(0, 115, 170, 0.69)';
constructor(
private router: Router,
@Inject(DOCUMENT) private document: Document,
) {
constructor() {
this.router.events.subscribe(
(event) => {
if (event instanceof NavigationStart) {