chore(deps): upgrade Angular 18 → 19
- ng update @angular/core@19 @angular/cli@19 @angular/material@19 @angular-eslint/schematics@19 - Migration: remove standalone:true (now default in v19) from 60 components - Migration: zone.js 0.14 → 0.15 - Fix pre-existing build budget error: raise initial bundle limit to 5mb (app ships large static JSON assets)
This commit is contained in:
@@ -18,34 +18,49 @@ import { BaseChartDirective } from 'ng2-charts';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { CalculatorInfo, CalculatorResult, CalculatorState, InputParams, Jump, LineConfig, WeightSizeRange, TableHeader, User, WeightSize, weightSizes } from '@models';
|
||||
import {
|
||||
CalculatorInfo,
|
||||
CalculatorResult,
|
||||
CalculatorState,
|
||||
InputParams,
|
||||
Jump,
|
||||
LineConfig,
|
||||
WeightSizeRange,
|
||||
TableHeader,
|
||||
User,
|
||||
WeightSize,
|
||||
weightSizes,
|
||||
} from '@models';
|
||||
import { CalculatorService, JumpsService, UserService, UtilitiesService } from '@services';
|
||||
|
||||
@Component({
|
||||
selector: 'app-calculator',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule, FormsModule, RouterModule,
|
||||
MatButtonModule, MatCardModule, MatDividerModule,
|
||||
MatFormFieldModule, MatInputModule, MatIconModule, MatMenuModule,
|
||||
MatPaginatorModule, MatProgressBarModule, MatSortModule, MatTableModule,
|
||||
BaseChartDirective
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
RouterModule,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatDividerModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
MatIconModule,
|
||||
MatMenuModule,
|
||||
MatPaginatorModule,
|
||||
MatProgressBarModule,
|
||||
MatSortModule,
|
||||
MatTableModule,
|
||||
BaseChartDirective,
|
||||
],
|
||||
templateUrl: './calculator.component.html',
|
||||
styleUrl: './calculator.component.scss',
|
||||
animations: [
|
||||
trigger('flyInOut', [
|
||||
state('in', style({ transform: 'translateY(0)' })),
|
||||
transition('void => *', [
|
||||
style({ transform: 'translateY(-100%)' }),
|
||||
animate(200)
|
||||
]),
|
||||
transition('* => void', [
|
||||
style({ transform: 'translateY(100%)' }),
|
||||
animate(200)
|
||||
])
|
||||
])
|
||||
]
|
||||
transition('void => *', [style({ transform: 'translateY(-100%)' }), animate(200)]),
|
||||
transition('* => void', [style({ transform: 'translateY(100%)' }), animate(200)]),
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class CalculatorComponent implements OnInit, OnDestroy {
|
||||
//private _lastjump!: Subscription; // = new Subscription();
|
||||
@@ -57,7 +72,7 @@ export class CalculatorComponent implements OnInit, OnDestroy {
|
||||
public currentRange: WeightSizeRange = {} as WeightSizeRange;
|
||||
public currentUser: User = {} as User;
|
||||
public displayedColumns: Array<string> = ['weight'];
|
||||
public tableHeader: Array<TableHeader> = [<TableHeader>{name: 'Poids nu en kg', active: ''}];
|
||||
public tableHeader: Array<TableHeader> = [<TableHeader>{ name: 'Poids nu en kg', active: '' }];
|
||||
public sizesHeader: Array<TableHeader> = [];
|
||||
public sizesValuesFeet: Array<number> = [];
|
||||
public sizesMinValuesFeet: Array<number> = [];
|
||||
@@ -71,41 +86,39 @@ export class CalculatorComponent implements OnInit, OnDestroy {
|
||||
charges: <CalculatorResult>{ current: 0, min: 0, min11: 0 },
|
||||
sizesFeet: <CalculatorResult>{ current: 0, min: 0, min11: 0 },
|
||||
sizesMeter: <CalculatorResult>{ current: 0, min: 0, min11: 0 },
|
||||
state: <CalculatorState>{ color: 'danger' }
|
||||
}
|
||||
state: <CalculatorState>{ color: 'danger' },
|
||||
};
|
||||
|
||||
@Input() canopy_size_table!: MatTableDataSource<WeightSize>;
|
||||
@Input() inputs: InputParams = <InputParams>{
|
||||
@Input() inputs: InputParams = (<InputParams>{
|
||||
jumps: 0,
|
||||
weight: 60,
|
||||
gear: 10,
|
||||
current: 190
|
||||
} as InputParams;
|
||||
current: 190,
|
||||
}) as InputParams;
|
||||
|
||||
@ViewChild(MatSort) sort!: MatSort;
|
||||
@ViewChild(MatPaginator) paginator!: MatPaginator;
|
||||
|
||||
|
||||
constructor(
|
||||
private _calculatorService: CalculatorService,
|
||||
private _jumpsService: JumpsService,
|
||||
private _userService: UserService,
|
||||
private _utilitiesService: UtilitiesService,
|
||||
public menuItems: MenuItems
|
||||
) { }
|
||||
public menuItems: MenuItems,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
const currentUser$: Observable<User> = this._userService.currentUser;
|
||||
const lastjump$: Observable<Jump> = this._jumpsService.getLastJump();
|
||||
|
||||
weightSizes[0].ranges.forEach((range: WeightSizeRange) => {
|
||||
const header: TableHeader = {name: range.label, active: range.active};
|
||||
this.tableHeader.push(header)
|
||||
const header: TableHeader = { name: range.label, active: range.active };
|
||||
this.tableHeader.push(header);
|
||||
this.sizesHeader.push(header);
|
||||
this.displayedColumns.push(range.name);
|
||||
});
|
||||
this.chartConfig.lineChartData.labels = [...this.sizesHeader.map(
|
||||
(data: TableHeader): string => data.name
|
||||
)];
|
||||
this.chartConfig.lineChartData.labels = [...this.sizesHeader.map((data: TableHeader): string => data.name)];
|
||||
this.chartConfig.lineChartData.datasets = [
|
||||
{
|
||||
label: 'Tailles min -11%',
|
||||
@@ -114,7 +127,7 @@ export class CalculatorComponent implements OnInit, OnDestroy {
|
||||
stepped: true,
|
||||
pointStyle: false,
|
||||
borderColor: 'rgba(241, 80, 80, 1)',
|
||||
backgroundColor: 'rgba(241, 80, 80, 0.3)'
|
||||
backgroundColor: 'rgba(241, 80, 80, 0.3)',
|
||||
},
|
||||
{
|
||||
label: 'Tailles min',
|
||||
@@ -123,8 +136,8 @@ export class CalculatorComponent implements OnInit, OnDestroy {
|
||||
stepped: true,
|
||||
pointStyle: false,
|
||||
borderColor: 'rgba(32, 182, 252, 1)',
|
||||
backgroundColor: 'rgba(32, 182, 252, 0.3)'
|
||||
}
|
||||
backgroundColor: 'rgba(32, 182, 252, 0.3)',
|
||||
},
|
||||
];
|
||||
this._subscriptions.push(
|
||||
currentUser$.subscribe((userData: User) => {
|
||||
@@ -137,9 +150,9 @@ export class CalculatorComponent implements OnInit, OnDestroy {
|
||||
this.inputs.current = jump.taille!;
|
||||
this.canopy_size_table = new MatTableDataSource<WeightSize>(weightSizes);
|
||||
this.refresh();
|
||||
})
|
||||
}),
|
||||
);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -149,7 +162,7 @@ export class CalculatorComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
public refresh():void {
|
||||
public refresh(): void {
|
||||
this._refreshActive();
|
||||
this._refreshSizes();
|
||||
}
|
||||
@@ -159,25 +172,25 @@ export class CalculatorComponent implements OnInit, OnDestroy {
|
||||
if (this.inputs.weight < 60) {
|
||||
weight = 60;
|
||||
}
|
||||
weightSizes.forEach(element => {
|
||||
weightSizes.forEach((element) => {
|
||||
element.active = '';
|
||||
element.ranges.forEach(range => {
|
||||
element.ranges.forEach((range) => {
|
||||
range.active = '';
|
||||
});
|
||||
});
|
||||
this.tableHeader.forEach(element => {
|
||||
this.tableHeader.forEach((element) => {
|
||||
element.active = '';
|
||||
});
|
||||
if (weight >= 60 && weight <= 110) {
|
||||
weightSizes[(weight - 60)].active = 'active';
|
||||
weightSizes[weight - 60].active = 'active';
|
||||
}
|
||||
if (this.inputs.jumps >= 0) {
|
||||
const num = this._calculatorService.getRangeNum(this.inputs.jumps);
|
||||
this.tableHeader[num].active = 'active';
|
||||
weightSizes.forEach(element => {
|
||||
element.ranges[(num-1)].active = 'active';
|
||||
weightSizes.forEach((element) => {
|
||||
element.ranges[num - 1].active = 'active';
|
||||
});
|
||||
this.currentRange = weightSizes[0].ranges[(num-1)];
|
||||
this.currentRange = weightSizes[0].ranges[num - 1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,13 +213,13 @@ export class CalculatorComponent implements OnInit, OnDestroy {
|
||||
this.info.sizesMeter = {
|
||||
current: this._calculatorService.convertFeet2Meters(this.inputs.current),
|
||||
min: this._calculatorService.convertFeet2Meters(this.info.sizesFeet.min),
|
||||
min11: this._calculatorService.convertFeet2Meters(this.info.sizesFeet.min11)
|
||||
}
|
||||
min11: this._calculatorService.convertFeet2Meters(this.info.sizesFeet.min11),
|
||||
};
|
||||
this.info.charges = {
|
||||
current: this._calculatorService.getCharge(this.inputs.current, this.inputs.weight, this.inputs.gear),
|
||||
min: this._calculatorService.getCharge(this.info.sizesFeet.min, this.inputs.weight, this.inputs.gear),
|
||||
min11: this._calculatorService.getCharge(this.info.sizesFeet.min11, this.inputs.weight, this.inputs.gear)
|
||||
}
|
||||
min11: this._calculatorService.getCharge(this.info.sizesFeet.min11, this.inputs.weight, this.inputs.gear),
|
||||
};
|
||||
this.info.state.color = this._calculatorService.getStateColor(this.info.sizesFeet);
|
||||
|
||||
this.chartConfig.lineChartData.datasets[0].data = this.sizesMinValuesFeet;
|
||||
@@ -218,5 +231,4 @@ export class CalculatorComponent implements OnInit, OnDestroy {
|
||||
this.inputs.weight = weight;
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user