Skip to content

Commit

Permalink
adapt numbers display
Browse files Browse the repository at this point in the history
  • Loading branch information
gehelem committed Dec 3, 2022
1 parent 81485d5 commit 38eacba
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import { MatToolbarModule} from '@angular/material/toolbar';
import { MatDialogModule} from '@angular/material/dialog';
import {MatTabsModule} from '@angular/material/tabs';
import { FormsModule } from '@angular/forms';

import { LOCALE_ID } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { registerLocaleData } from '@angular/common';
import localeFr from '@angular/common/locales/fr';
registerLocaleData(localeFr);
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { WebsocketService } from './websocket.service';
Expand Down Expand Up @@ -57,7 +61,9 @@ import { NgChartsModule } from 'ng2-charts';
MatTableModule,
NgChartsModule
],
providers: [],
providers: [
{ provide: LOCALE_ID, useValue: 'fr-FR'},
],
bootstrap: [AppComponent]
})
export class AppModule {
Expand Down
6 changes: 3 additions & 3 deletions src/app/prop/prop.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@

<tr *ngIf="(isNumber(elt.value.value))">
<td style="min-width:150px"><label>{{elt.value.label}}</label></td>
<td><input *ngIf="(!(this.ws.datastore.mods[mod].prps[prop].permission==0))" matInput value={{elt.value.value}} (click)="this.openEditProp(this.ws.datastore.mods[mod].prps[prop],elt.key)"></td>
<td><label *ngIf="(this.ws.datastore.mods[mod].prps[prop].permission==0)">{{elt.value.value}}</label></td>
<td><input *ngIf="(!(this.ws.datastore.mods[mod].prps[prop].permission==0))" matInput value="{{elt.value.valueN | number}}" (click)="this.openEditProp(this.ws.datastore.mods[mod].prps[prop],elt.key)"></td>
<td><label *ngIf="(this.ws.datastore.mods[mod].prps[prop].permission==0)">{{elt.value.valueN | number}}</label></td>
</tr>

</ng-container>
</table>

<ng-container *ngIf="this.ws.datastore.mods[mod].prps[prop].grid2.length>10000">
<ng-container *ngIf="this.ws.datastore.mods[mod].prps[prop].grid2.length>0">

<table #mytable mat-table [dataSource]="this.ws.datastore.mods[mod].prps[prop].grid2" class="mat-elevation-z8 demo-table">
<ng-container *ngFor="let e of this.ws.datastore.mods[mod].prps[prop].elts | keyvalue:originalOrderElt" [matColumnDef]="e.key">
Expand Down
12 changes: 12 additions & 0 deletions src/datastructure/elt.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@

export class Elt {
label: string='';
value: string | number | boolean = false;
valueN:number=0;
min: number=0;
max: number=0;
step: number=0;
order: string='';
isNumber(val: any): boolean {
return typeof val === 'number';
}

setValue (json:any) {
if (json) {
this.value=json['value'];
if (this.isNumber(json['value'])) {
this.valueN=json['value'];
}
}
}
setAll (json:any) {
if (json) {
this.label=json['elementLabel'];
this.value=json['value'];
if (this.isNumber(json['value'])) {
this.valueN=json['value'];
}
this.min=json['min'];
this.max=json['max'];
this.step=json['step'];
Expand Down

0 comments on commit 38eacba

Please sign in to comment.