Skip to content
Snippets Groups Projects
Commit e76567f4 authored by David Dorchies's avatar David Dorchies
Browse files

#44 Merge origin

parents fb2958bf ef75947e
No related branches found
No related tags found
1 merge request!24Resolve "Ajout de la calculette "passe à enrochement""
Showing
with 3187 additions and 4612 deletions
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
"testTsconfig": "tsconfig.spec.json", "testTsconfig": "tsconfig.spec.json",
"prefix": "app", "prefix": "app",
"styles": [ "styles": [
"../node_modules/font-awesome/scss/font-awesome.scss",
"../node_modules/angular-bootstrap-md/scss/bootstrap/bootstrap.scss", "../node_modules/angular-bootstrap-md/scss/bootstrap/bootstrap.scss",
"../node_modules/angular-bootstrap-md/scss/mdb-free.scss", "../node_modules/angular-bootstrap-md/scss/mdb-free.scss",
"./styles.scss" "./styles.scss"
......
# Installation des icônes FontAwesome
Télécharger l'archive ici :
http://fontawesome.io/get-started/#modal-download
Désarchiver dans src/assets. On obtient par exemple un répertoire _font-awesome-4.7.0_
Dans _index.html_, ajouter dans _<head>_ :
<link rel="stylesheet" href="assets/font-awesome-4.7.0/css/font-awesome.css">
Utiliser les icônes avec :
<i class="fa fa-ellipsis-v" aria-hidden="true"></i>
This diff is collapsed.
{ {
"name": "ngHyd", "name": "nghyd",
"version": "1.1.0", "version": "1.1.0",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "npm run preprocess; ng serve --host 0.0.0.0", "start": "npm run preprocess; ng serve --host 0.0.0.0",
"prod": "npm run preprocess; ng serve --host 0.0.0.0 --env=prod", "prod": "npm run preprocess; ng serve --host 0.0.0.0 --prod",
"build": "npm run preprocess; ng build", "build": "npm run preprocess; ng build",
"test": "ng test", "test": "ng test",
"lint": "ng lint", "lint": "ng lint",
...@@ -16,29 +16,30 @@ ...@@ -16,29 +16,30 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "^5.0.0", "@angular/animations": "^5.2.11",
"@angular/common": "^5.0.0", "@angular/common": "^5.2.11",
"@angular/compiler": "^5.0.0", "@angular/compiler": "^5.2.11",
"@angular/core": "^5.0.0", "@angular/core": "^5.2.11",
"@angular/forms": "^5.0.0", "@angular/forms": "^5.2.11",
"@angular/http": "^5.0.0", "@angular/http": "^5.2.11",
"@angular/platform-browser": "^5.0.0", "@angular/platform-browser": "^5.2.11",
"@angular/platform-browser-dynamic": "^5.0.0", "@angular/platform-browser-dynamic": "^5.2.11",
"@angular/router": "^5.0.0", "@angular/router": "^5.2.11",
"angular-bootstrap-md": "^5.0.5", "angular-bootstrap-md": "~6.0.0",
"angular2-chartjs": "^0.4.1", "angular2-chartjs": "^0.4.1",
"core-js": "^2.4.1", "core-js": "^2.5.7",
"file-saver": "^1.3.8", "file-saver": "^1.3.8",
"font-awesome": "^4.7.0",
"he": "^1.1.1", "he": "^1.1.1",
"jalhyd": "file:../jalhyd/jalhyd-1.0.0.tgz", "jalhyd": "file:../jalhyd/jalhyd-1.0.0.tgz",
"mathjax": "^2.7.4", "mathjax": "^2.7.4",
"ngx-md": "^3.1.1", "ngx-md": "^3.1.1",
"rxjs": "^5.5.2", "rxjs": "^5.5.11",
"zone.js": "^0.8.14" "zone.js": "^0.8.26"
}, },
"devDependencies": { "devDependencies": {
"@angular/cli": "1.5.4", "@angular/cli": "1.7.4",
"@angular/compiler-cli": "^5.0.0", "@angular/compiler-cli": "~5.2.0",
"@angular/language-service": "^5.0.0", "@angular/language-service": "^5.0.0",
"@types/file-saver": "^1.3.0", "@types/file-saver": "^1.3.0",
"@types/jasmine": "~2.5.53", "@types/jasmine": "~2.5.53",
...@@ -56,6 +57,6 @@ ...@@ -56,6 +57,6 @@
"protractor": "~5.1.2", "protractor": "~5.1.2",
"ts-node": "~3.2.0", "ts-node": "~3.2.0",
"tslint": "~5.7.0", "tslint": "~5.7.0",
"typescript": "~2.4.2" "typescript": "~2.6.0"
} }
} }
import { TestBed, async } from '@angular/core/testing'; import { TestBed, async } from "@angular/core/testing";
import { AppComponent } from './app.component'; import { AppComponent } from "./app.component";
describe('AppComponent', () => { describe("AppComponent", () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ declarations: [
...@@ -8,7 +8,7 @@ describe('AppComponent', () => { ...@@ -8,7 +8,7 @@ describe('AppComponent', () => {
], ],
}).compileComponents(); }).compileComponents();
})); }));
it('should create the app', async(() => { it("should create the app", async(() => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance; const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy(); expect(app).toBeTruthy();
...@@ -16,12 +16,12 @@ describe('AppComponent', () => { ...@@ -16,12 +16,12 @@ describe('AppComponent', () => {
it(`should have as title 'app'`, async(() => { it(`should have as title 'app'`, async(() => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance; const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app'); expect(app.title).toEqual("app");
})); }));
it('should render title in a h1 tag', async(() => { it("should render title in a h1 tag", async(() => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges(); fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement; const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); expect(compiled.querySelector("h1").textContent).toContain("Welcome to app!");
})); }));
}); });
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { MDBBootstrapModule } from 'angular-bootstrap-md'; import { MDBBootstrapModule } from "angular-bootstrap-md";
import { HttpModule } from '@angular/http'; import { HttpModule } from "@angular/http";
import { FormsModule } from '@angular/forms'; // <-- NgModel lives here import { FormsModule } from "@angular/forms"; // <-- NgModel lives here
//import { MdInputModule, MdDialogModule } from '@angular/material'; // import { MdInputModule, MdDialogModule } from '@angular/material';
import { ChartModule } from 'angular2-chartjs'; import { ChartModule } from "angular2-chartjs";
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from "@angular/router";
import { MarkdownModule } from 'ngx-md'; import { MarkdownModule } from "ngx-md";
import { FormulaireService } from "./services/formulaire/formulaire.service"; import { FormulaireService } from "./services/formulaire/formulaire.service";
import { ParamService } from "./services/param/param.service"; import { ParamService } from "./services/param/param.service";
import { InternationalisationService } from "./services/internationalisation/internationalisation.service"; import { InternationalisationService } from "./services/internationalisation/internationalisation.service";
import { HttpService } from "./services/http/http.service"; import { HttpService } from "./services/http/http.service";
import { ApplicationSetupService } from "./services/app-setup/app-setup.service"; import { ApplicationSetupService } from "./services/app-setup/app-setup.service";
import { AppComponent } from './app.component'; import { AppComponent } from "./app.component";
import { NgParamInputComponent } from './components/ngparam-input/ngparam-input.component'; import { NgParamInputComponent } from "./components/ngparam-input/ngparam-input.component";
import { FieldSetComponent } from './components/field-set/field-set.component'; import { FieldSetComponent } from "./components/field-set/field-set.component";
import { FieldsetContainerComponent } from './components/fieldset-container/fieldset-container.component'; import { FieldsetContainerComponent } from "./components/fieldset-container/fieldset-container.component";
import { ParamFieldLineComponent } from './components/param-field-line/param-field-line.component'; import { ParamFieldLineComponent } from "./components/param-field-line/param-field-line.component";
import { NgParamMinComponent } from './components/param-values/ngparam-min.component'; import { NgParamMinComponent } from "./components/param-values/ngparam-min.component";
import { NgParamMaxComponent } from './components/param-values/ngparam-max.component'; import { NgParamMaxComponent } from "./components/param-values/ngparam-max.component";
import { NgParamStepComponent } from './components/param-values/ngparam-step.component'; import { NgParamStepComponent } from "./components/param-values/ngparam-step.component";
import { ParamValuesComponent } from './components/param-values/param-values.component'; import { ParamValuesComponent } from "./components/param-values/param-values.component";
import { ValueListComponent } from './components/param-values/value-list.component'; import { ValueListComponent } from "./components/param-values/value-list.component";
import { SelectFieldLineComponent } from './components/select-field-line/select-field-line.component'; import { SelectFieldLineComponent } from "./components/select-field-line/select-field-line.component";
import { CheckFieldLineComponent } from './components/check-field-line/check-field-line.component'; import { CheckFieldLineComponent } from "./components/check-field-line/check-field-line.component";
// import { AlertDialog } from './components/alert-dialog/alert-dialog.component'; // import { AlertDialog } from './components/alert-dialog/alert-dialog.component';
import { AppErrorModule } from './error.module'; import { AppErrorModule } from "./error.module";
import { CalculatorResultsComponent } from './components/calculator-results/calculator-results.component'; import { CalculatorResultsComponent } from "./components/calculator-results/calculator-results.component";
import { FixedVarResultsComponent } from './components/fixedvar-results/fixedvar-results.component'; import { FixedVarResultsComponent } from "./components/fixedvar-results/fixedvar-results.component";
import { SectionResultsComponent } from './components/section-results/section-results.component'; import { SectionResultsComponent } from "./components/section-results/section-results.component";
import { GenericCalculatorComponent } from './components/generic-calculator/calculator.component'; import { GenericCalculatorComponent } from "./components/generic-calculator/calculator.component";
import { CalculatorNameComponent } from './components/generic-calculator/calc-name.component'; import { CalculatorNameComponent } from "./components/generic-calculator/calc-name.component";
import { CalcCanvasComponent } from './components/canvas/canvas.component'; import { CalcCanvasComponent } from "./components/canvas/canvas.component";
import { SectionCanvasComponent } from './components/section-canvas/section-canvas.component'; import { SectionCanvasComponent } from "./components/section-canvas/section-canvas.component";
import { RemousResultsComponent } from './components/remous-results/remous-results.component'; import { RemousResultsComponent } from "./components/remous-results/remous-results.component";
import { ResultsGraphComponent } from './components/results-graph/results-graph.component'; import { ResultsGraphComponent } from "./components/results-graph/results-graph.component";
import { GraphTypeSelectComponent } from './components/results-graph/graph-type.component'; import { GraphTypeSelectComponent } from "./components/results-graph/graph-type.component";
import { LogComponent } from './components/log/log.component'; import { LogComponent } from "./components/log/log.component";
import { CalculatorListComponent } from './components/calculator-list/calculator-list.component'; import { CalculatorListComponent } from "./components/calculator-list/calculator-list.component";
import { ApplicationSetupComponent } from './components/app-setup/app-setup.component'; import { ApplicationSetupComponent } from "./components/app-setup/app-setup.component";
import { BaseParamInputComponent } from './components/base-param-input/base-param-input.component'; import { BaseParamInputComponent } from "./components/base-param-input/base-param-input.component";
import { FixedResultsComponent } from './components/fixedvar-results/fixed-results.component'; import { FixedResultsComponent } from "./components/fixedvar-results/fixed-results.component";
import { VarResultsComponent } from './components/fixedvar-results/var-results.component'; import { VarResultsComponent } from "./components/fixedvar-results/var-results.component";
import { HorizontalResultElementComponent } from './components/result-element/horizontal-result-element.component' import { ResultElementBaseComponent } from "./components/result-element/result-element-base.component";
import { VerticalResultElementComponent } from './components/result-element/vertical-result-element.component'; import { HorizontalResultElementComponent } from "./components/result-element/horizontal-result-element.component";
import { LogEntryComponent } from './components/log-entry/log-entry.component'; import { VerticalResultElementComponent } from "./components/result-element/vertical-result-element.component";
import { HelpService } from './services/help/help.service'; import { LogEntryComponent } from "./components/log-entry/log-entry.component";
import { HelpComponent } from './components/help/help.component'; import { HelpService } from "./services/help/help.service";
import { LoadCalculatorComponent } from './components/load-calculator/load-calculator.component'; import { HelpComponent } from "./components/help/help.component";
import { LoadCalcDialogAnchorDirective } from './components/load-calculator/load-calculator-anchor.directive'; import { LoadCalculatorComponent } from "./components/load-calculator/load-calculator.component";
import { SaveCalculatorComponent } from './components/save-calculator/save-calculator.component'; import { LoadCalcDialogAnchorDirective } from "./components/load-calculator/load-calculator-anchor.directive";
import { SaveCalcDialogAnchorDirective } from './components/save-calculator/save-calculator-anchor.directive'; import { SaveCalculatorComponent } from "./components/save-calculator/save-calculator.component";
import { ParamLinkComponent } from './components/param-link/param-link.component'; import { SaveCalcDialogAnchorDirective } from "./components/save-calculator/save-calculator-anchor.directive";
import { ParamLinkComponent } from "./components/param-link/param-link.component";
const appRoutes: Routes = [ const appRoutes: Routes = [
{ path: 'list', component: CalculatorListComponent }, { path: "list", component: CalculatorListComponent },
{ path: 'calculator/:uid', component: GenericCalculatorComponent }, { path: "calculator/:uid", component: GenericCalculatorComponent },
{ path: 'setup', component: ApplicationSetupComponent }, { path: "setup", component: ApplicationSetupComponent },
{ path: 'help', component: HelpComponent }, { path: "help", component: HelpComponent },
{ path: '**', component: CalculatorListComponent } { path: "**", component: CalculatorListComponent }
]; ];
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forRoot( RouterModule.forRoot(
appRoutes, appRoutes,
//{ enableTracing: true } // <-- debugging purposes only // { enableTracing: true } // <-- debugging purposes only
{ enableTracing: false } { enableTracing: false }
), ),
BrowserModule, BrowserModule,
...@@ -97,7 +98,7 @@ const appRoutes: Routes = [ ...@@ -97,7 +98,7 @@ const appRoutes: Routes = [
CalculatorResultsComponent, FixedVarResultsComponent, SectionResultsComponent, RemousResultsComponent, CalculatorResultsComponent, FixedVarResultsComponent, SectionResultsComponent, RemousResultsComponent,
ResultsGraphComponent, GraphTypeSelectComponent, ResultsGraphComponent, GraphTypeSelectComponent,
CalcCanvasComponent, SectionCanvasComponent, CalcCanvasComponent, SectionCanvasComponent,
HorizontalResultElementComponent, VerticalResultElementComponent, ResultElementBaseComponent, HorizontalResultElementComponent, VerticalResultElementComponent,
FixedResultsComponent, VarResultsComponent, FixedResultsComponent, VarResultsComponent,
HelpComponent, HelpComponent,
LoadCalculatorComponent, LoadCalcDialogAnchorDirective, LoadCalculatorComponent, LoadCalcDialogAnchorDirective,
......
<div class="btn-group" dropdown (click)="onSelect($event)"> <div class="btn-group" dropdown (selected)="onSelect($event)">
<button dropdownToggle class="btn btn-primary dropdown-toggle waves-light my-1" type="button" mdbRippleRadius> <button dropdownToggle class="btn btn-primary dropdown-toggle waves-light my-1" type="button" mdbRippleRadius>
{{currentLabel}} {{currentLabel}}
</button> </button>
......
...@@ -15,12 +15,14 @@ import { BaseComponent } from "../base/base.component"; ...@@ -15,12 +15,14 @@ import { BaseComponent } from "../base/base.component";
*/ */
export abstract class GenericSelectComponent<T> { export abstract class GenericSelectComponent<T> {
private get currentLabel(): string {
for (let e of this.entries)
if (e == this.selectedValue)
return this.entryLabel(e);
return "<no selection>"; private _currentLabel: string;
private get currentLabel(): string {
if (this._currentLabel === undefined) {
this._currentLabel = this.selectedLabel;
}
return this._currentLabel;
} }
/** /**
...@@ -28,8 +30,18 @@ export abstract class GenericSelectComponent<T> { ...@@ -28,8 +30,18 @@ export abstract class GenericSelectComponent<T> {
*/ */
private onSelect(event: any) { private onSelect(event: any) {
const val = event.target.value; const val = event.target.value;
if (val != undefined) if (val !== undefined && val !== "") {
this.selectedValue = val; this.selectedValue = val;
this._currentLabel = this.selectedLabel;
}
}
private get selectedLabel(): string {
for (const e of this.entries) {
if (e === this.selectedValue) {
return this.entryLabel(e);
}
}
} }
/** /**
......
import { Component, Input, OnChanges } from "@angular/core"; import { Component, Input, OnChanges } from "@angular/core";
import { Message, MessageSeverity } from 'jalhyd'; import { Message, MessageSeverity } from "jalhyd";
import { InternationalisationService } from "../../services/internationalisation/internationalisation.service"; import { InternationalisationService } from "../../services/internationalisation/internationalisation.service";
import { ApplicationSetupService } from '../../services/app-setup/app-setup.service'; import { ApplicationSetupService } from "../../services/app-setup/app-setup.service";
@Component({ @Component({
selector: "log-entry", selector: "log-entry",
...@@ -49,14 +49,14 @@ export class LogEntryComponent implements OnChanges { ...@@ -49,14 +49,14 @@ export class LogEntryComponent implements OnChanges {
} }
private get levelInfo(): boolean { private get levelInfo(): boolean {
return this._message.getSeverity() == MessageSeverity.INFO; return this._message.getSeverity() === MessageSeverity.INFO;
} }
private get levelWarning(): boolean { private get levelWarning(): boolean {
return this._message.getSeverity() == MessageSeverity.WARNING; return this._message.getSeverity() === MessageSeverity.WARNING;
} }
private get levelError(): boolean { private get levelError(): boolean {
return this._message.getSeverity() == MessageSeverity.ERROR; return this._message.getSeverity() === MessageSeverity.ERROR;
} }
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
</ng-template> </ng-template>
<td *ngIf="hasValue" class="label2"> <td *ngIf="hasValue" class="label2">
{{resultLabel}} {{ resultLabel }}
</td> </td>
<td *ngIf="hasValue||hasError" [mdbTooltip]="popTemplate" [isDisabled]="tooltipDisabled" class="value2"> <td *ngIf="hasValue||hasError" [mdbTooltip]="popTemplate" [isDisabled]="tooltipDisabled" class="value2">
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<!-- valeur --> <!-- valeur -->
<span *ngIf="hasValue"> <span *ngIf="hasValue">
{{resultValue}} {{ resultValue }}
</span> </span>
</td> </td>
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
<!-- résultats complémentaires --> <!-- résultats complémentaires -->
<tr> <tr>
<td class={{c.label_class}}> <td class={{c.label_class}}>
{{r.label}} {{ r.label }}
</td> </td>
<td class={{c.value_class}}> <td class={{c.value_class}}>
{{r.value}} {{ r.value }}
</td> </td>
</tr> </tr>
</ng-template> </ng-template>
\ No newline at end of file
import { Component, Input, ViewChild, TemplateRef, ViewContainerRef } from "@angular/core"; import { Component, Input, ViewChild, TemplateRef, ViewContainerRef } from "@angular/core";
import { ResultElement } from 'jalhyd'; import { ResultElement } from "jalhyd";
import { ApplicationSetupService } from "../../services/app-setup/app-setup.service"; import { ApplicationSetupService } from "../../services/app-setup/app-setup.service";
import { InternationalisationService } from "../../services/internationalisation/internationalisation.service"; import { InternationalisationService } from "../../services/internationalisation/internationalisation.service";
...@@ -50,14 +50,16 @@ export class VerticalResultElementComponent extends ResultElementBaseComponent { ...@@ -50,14 +50,16 @@ export class VerticalResultElementComponent extends ResultElementBaseComponent {
if (this._resultElement) { if (this._resultElement) {
let i = 0; let i = 0;
for (const k in this._resultElement.extraResults) { for (const k in this._resultElement.extraResults) {
const er: number = this._resultElement.extraResults[k]; if (this._resultElement.extraResults.hasOwnProperty(k)) {
const lblClass = (i % 2) == 0 ? "label1" : "label2"; const er: number = this._resultElement.extraResults[k];
const valueClass = (i % 2) == 0 ? "value1" : "value2"; const lblClass = (i % 2) === 0 ? "label1" : "label2";
this.vcRef.createEmbeddedView(this.trTemplate, { const valueClass = (i % 2) === 0 ? "value1" : "value2";
extraRes: { "label": this.intlService.getExtraResLabel(k), "value": this.intlService.formatResult(k, er) }, this.vcRef.createEmbeddedView(this.trTemplate, {
classes: { "label_class": lblClass, "value_class": valueClass } extraRes: { "label": this.intlService.getExtraResLabel(k), "value": this.intlService.formatResult(k, er) },
}); classes: { "label_class": lblClass, "value_class": valueClass }
i++; });
i++;
}
} }
} }
} }
......
...@@ -7,4 +7,4 @@ export class DeepFormulaireNodeIterator extends AbstractFormulaireNodeIterator<F ...@@ -7,4 +7,4 @@ export class DeepFormulaireNodeIterator extends AbstractFormulaireNodeIterator<F
[Symbol.iterator](): IterableIterator<FormulaireNode> { [Symbol.iterator](): IterableIterator<FormulaireNode> {
return this; return this;
} }
} }
\ No newline at end of file
...@@ -60,8 +60,9 @@ export class NgParameter extends InputField implements Observer { ...@@ -60,8 +60,9 @@ export class NgParameter extends InputField implements Observer {
} }
public set confId(id: string) { public set confId(id: string) {
if (this._confId != undefined) if (this._confId != undefined) {
throw new Error(`NgParameter : l'identifiant de configuration est déjà défini (${this._confId})`); throw new Error(`NgParameter : l'identifiant de configuration est déjà défini (${this._confId})`);
}
this._confId = id; this._confId = id;
} }
...@@ -122,8 +123,9 @@ export class NgParameter extends InputField implements Observer { ...@@ -122,8 +123,9 @@ export class NgParameter extends InputField implements Observer {
let o = asObservable(this._paramDef.referencedObject); let o = asObservable(this._paramDef.referencedObject);
if (this.valueMode === ParamValueMode.LINK) { if (this.valueMode === ParamValueMode.LINK) {
this._paramDef.undefineReference(); this._paramDef.undefineReference();
if (o !== undefined) if (o !== undefined) {
o.removeObserver(this); o.removeObserver(this);
}
} }
} }
...@@ -131,18 +133,22 @@ export class NgParameter extends InputField implements Observer { ...@@ -131,18 +133,22 @@ export class NgParameter extends InputField implements Observer {
* crée le lien avec un paramètre * crée le lien avec un paramètre
*/ */
public linkToParameter(n: Nub, ref: string) { public linkToParameter(n: Nub, ref: string) {
const changed: boolean = this._paramDef.valueMode !== ParamValueMode.LINK || this._paramDef.referencedNub !== n || this._paramDef.referenceDefinition !== ref; const changed: boolean =
this._paramDef.valueMode !== ParamValueMode.LINK || this._paramDef.referencedNub !== n ||
this._paramDef.referenceDefinition !== ref;
if (changed) { if (changed) {
let o = asObservable(this._paramDef.referencedObject); let o = asObservable(this._paramDef.referencedObject);
if (o !== undefined) if (o !== undefined) {
o.removeObserver(this); o.removeObserver(this);
}
this.valueMode = ParamValueMode.LINK; this.valueMode = ParamValueMode.LINK;
this._paramDef.defineReference(n, ref); this._paramDef.defineReference(n, ref);
o = asObservable(this._paramDef.referencedObject); o = asObservable(this._paramDef.referencedObject);
if (o !== undefined) if (o !== undefined) {
o.addObserver(this); // pour être prévenu des changements de valeur de l'object référencé o.addObserver(this); // pour être prévenu des changements de valeur de l'object référencé
}
this.notifyObservers({ this.notifyObservers({
"action": "valueLinkChange", "action": "valueLinkChange",
...@@ -160,8 +166,9 @@ export class NgParameter extends InputField implements Observer { ...@@ -160,8 +166,9 @@ export class NgParameter extends InputField implements Observer {
} }
public checkList(l: number[]) { public checkList(l: number[]) {
for (let e of l) for (let e of l) {
this.checkValue(e); this.checkValue(e);
}
} }
public get valueMode() { public get valueMode() {
......
...@@ -3,16 +3,20 @@ import { NgParameter } from "../formulaire/ngparam"; ...@@ -3,16 +3,20 @@ import { NgParameter } from "../formulaire/ngparam";
export abstract class CalculatorResults { export abstract class CalculatorResults {
public static paramLabel(p: NgParameter, displaySymbol: boolean): string { public static paramLabel(p: NgParameter, displaySymbol: boolean): string {
let res = ""; let res = "";
if (displaySymbol) if (displaySymbol) {
res += p.symbol; res += p.symbol;
if (p.label != undefined && p.label != "") }
if (p.symbol != p.label || !displaySymbol) { if (p.label !== undefined && p.label !== "") {
if (res.length > 0) if (p.symbol !== p.label || !displaySymbol) {
if (res.length > 0) {
res += " : "; res += " : ";
}
res += p.label; res += p.label;
} }
if (p.unit != undefined && p.unit != "") }
if (p.unit !== undefined && p.unit !== "") {
res += " (" + p.unit + ")"; res += " (" + p.unit + ")";
}
return res; return res;
} }
......
...@@ -90,8 +90,10 @@ export class InternationalisationService extends Observable { ...@@ -90,8 +90,10 @@ export class InternationalisationService extends Observable {
} }
public setLocale(lng: string | LanguageCode) { public setLocale(lng: string | LanguageCode) {
if (this._currLang !== undefined) let oldLang;
var oldLang: LanguageCode = this._currLang.code; if (this._currLang !== undefined) {
oldLang = this._currLang.code;
}
if (typeof lng === "string") { if (typeof lng === "string") {
const t: string = lng.substr(0, 2).toLowerCase(); const t: string = lng.substr(0, 2).toLowerCase();
...@@ -107,7 +109,7 @@ export class InternationalisationService extends Observable { ...@@ -107,7 +109,7 @@ export class InternationalisationService extends Observable {
const is: InternationalisationService = this; const is: InternationalisationService = this;
prom.then((res) => { prom.then((res) => {
is.notifyObservers(undefined); is.notifyObservers(undefined);
}) });
} }
} }
...@@ -128,12 +130,14 @@ export class InternationalisationService extends Observable { ...@@ -128,12 +130,14 @@ export class InternationalisationService extends Observable {
l = "en"; l = "en";
} }
const f: string = "error_messages." + l + ".json"; const f: string = "messages." + l + ".json";
return ServiceFactory.instance.httpService.httpGetRequest(undefined, undefined, undefined, "locale/" + f, processData); return ServiceFactory.instance.httpService.httpGetRequest(undefined, undefined, undefined, "locale/" + f, processData);
} }
private getMessageFromCode(c: MessageCode): string { private getMessageFromCode(c: MessageCode): string {
const sCode: string = MessageCode[c]; if (this._Messages[MessageCode[c]] === undefined) {
return `*** Message ${MessageCode[c]} non traduit ***`;
}
return this._Messages[MessageCode[c]]; return this._Messages[MessageCode[c]];
} }
......
export function logObject(obj: {}, m?: string) { export function logObject(obj: {}, m?: string) {
// évite le message "Value below was evaluated just now" dans le debugger de Chrome // évite le message "Value below was evaluated just now" dans le debugger de Chrome
if (m == undefined) if (m === undefined) {
console.log(JSON.stringify(obj)); console.log(JSON.stringify(obj));
else } else {
console.log(m + " " + JSON.stringify(obj)); console.log(m + " " + JSON.stringify(obj));
}
} }
export function isNumber(s: string): boolean { export function isNumber(s: string): boolean {
return Number(s) != NaN; return Number(s) !== NaN;
} }
I hope you love Font Awesome. If you've found it useful, please do me a favor and check out my latest project,
Fort Awesome (https://fortawesome.com). It makes it easy to put the perfect icons on your website. Choose from our awesome,
comprehensive icon sets or copy and paste your own.
Please. Check it out.
-Dave Gandy
This diff is collapsed.
This diff is collapsed.
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment