Skip to content
Snippets Groups Projects
Commit 219393dc authored by mathias.chouet's avatar mathias.chouet
Browse files

Màj jalhyd: utilisation de isNumeric() au lieu de NumericalString

parent d0ae7476
No related branches found
No related tags found
1 merge request!32Resolve "Simplification du code (compatibilité jalhyd)"
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { Component, ChangeDetectorRef } from "@angular/core"; import { Component, ChangeDetectorRef } from "@angular/core";
import { NumericalString, Message, ParamDefinition, ParamDomain, ParamDomainValue, Observable } from "jalhyd"; import { Message, ParamDefinition, ParamDomain, ParamDomainValue, Observable, isNumeric } from "jalhyd";
import { InternationalisationService } from "../../services/internationalisation/internationalisation.service"; import { InternationalisationService } from "../../services/internationalisation/internationalisation.service";
import { GenericInputComponent } from "../generic-input/generic-input.component"; import { GenericInputComponent } from "../generic-input/generic-input.component";
...@@ -102,8 +102,7 @@ export class BaseParamInputComponent extends GenericInputComponent { ...@@ -102,8 +102,7 @@ export class BaseParamInputComponent extends GenericInputComponent {
let valid = false; let valid = false;
let msg: string; let msg: string;
const v: NumericalString = new NumericalString(ui); if (! isNumeric(ui)) {
if (!v.isNumerical) {
msg = "Veuillez entrer une valeur numérique"; msg = "Veuillez entrer une valeur numérique";
} else { } else {
valid = true; valid = true;
......
...@@ -295,7 +295,7 @@ export abstract class GenericInputComponent extends BaseComponent implements OnC ...@@ -295,7 +295,7 @@ export abstract class GenericInputComponent extends BaseComponent implements OnC
/* /*
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { NumericalString, Message } from "jalhyd"; import { isNumeric, Message } from "jalhyd";
// exemple où le modèle est un type simple (number) // exemple où le modèle est un type simple (number)
...@@ -343,8 +343,7 @@ export class TestInputComponent extends GenericInputComponent { ...@@ -343,8 +343,7 @@ export class TestInputComponent extends GenericInputComponent {
let valid: boolean = false; let valid: boolean = false;
let msg: string = undefined; let msg: string = undefined;
let v: NumericalString = new NumericalString(ui); if (! isNumeric(ui))
if (!v.isNumerical)
msg = "Veuillez entrer une valeur numérique"; msg = "Veuillez entrer une valeur numérique";
else else
valid = true; valid = true;
...@@ -410,8 +409,7 @@ export class Test2InputComponent extends GenericInputComponent { ...@@ -410,8 +409,7 @@ export class Test2InputComponent extends GenericInputComponent {
let valid: boolean = false; let valid: boolean = false;
let msg: string = undefined; let msg: string = undefined;
let v: NumericalString = new NumericalString(ui); if (! isNumeric(ui))
if (!v.isNumerical)
msg = "Veuillez entrer une valeur numérique"; msg = "Veuillez entrer une valeur numérique";
else else
valid = true; valid = true;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { Component, ChangeDetectorRef, OnDestroy } from "@angular/core"; import { Component, ChangeDetectorRef, OnDestroy } from "@angular/core";
import { NumericalString, Message, Observer } from "jalhyd"; import { isNumeric, Message, Observer } from "jalhyd";
import { InternationalisationService } from "../../services/internationalisation/internationalisation.service"; import { InternationalisationService } from "../../services/internationalisation/internationalisation.service";
import { NgParameter } from "../../formulaire/ngparam"; import { NgParameter } from "../../formulaire/ngparam";
...@@ -94,8 +94,7 @@ export class NgParamInputComponent extends GenericInputComponent implements Obse ...@@ -94,8 +94,7 @@ export class NgParamInputComponent extends GenericInputComponent implements Obse
let valid = false; let valid = false;
let msg: string; let msg: string;
const v: NumericalString = new NumericalString(ui); if (! isNumeric(ui)) {
if (!v.isNumerical) {
msg = "Veuillez entrer une valeur numérique"; msg = "Veuillez entrer une valeur numérique";
} else { } else {
valid = true; valid = true;
......
import { Component, Input, ChangeDetectorRef } from "@angular/core"; import { Component, Input, ChangeDetectorRef } from "@angular/core";
import { NumericalString } from "jalhyd"; import { isNumeric } from "jalhyd";
import { GenericInputComponent } from "../generic-input/generic-input.component"; import { GenericInputComponent } from "../generic-input/generic-input.component";
import { InternationalisationService } from "../../services/internationalisation/internationalisation.service"; import { InternationalisationService } from "../../services/internationalisation/internationalisation.service";
...@@ -23,7 +23,7 @@ export class NgParamMaxComponent extends GenericInputComponent { ...@@ -23,7 +23,7 @@ export class NgParamMaxComponent extends GenericInputComponent {
} }
protected getModelValue(): any { protected getModelValue(): any {
if (this._param == undefined) { if (this._param === undefined) {
return undefined; return undefined;
} }
return this._param.maxValue; return this._param.maxValue;
...@@ -37,7 +37,7 @@ export class NgParamMaxComponent extends GenericInputComponent { ...@@ -37,7 +37,7 @@ export class NgParamMaxComponent extends GenericInputComponent {
let msg; let msg;
let valid = false; let valid = false;
if (this._param == undefined) { if (this._param === undefined) {
msg = "internal error, model undefined"; msg = "internal error, model undefined";
} else { } else {
if (!this._param.checkMax(v)) { if (!this._param.checkMax(v)) {
...@@ -51,7 +51,7 @@ export class NgParamMaxComponent extends GenericInputComponent { ...@@ -51,7 +51,7 @@ export class NgParamMaxComponent extends GenericInputComponent {
} }
protected modelToUI(v: any): string { protected modelToUI(v: any): string {
if (typeof (v) == "number") { if (typeof (v) === "number") {
return String(v); return String(v);
} }
return undefined; return undefined;
...@@ -61,8 +61,7 @@ export class NgParamMaxComponent extends GenericInputComponent { ...@@ -61,8 +61,7 @@ export class NgParamMaxComponent extends GenericInputComponent {
let valid = false; let valid = false;
let msg: string; let msg: string;
const v: NumericalString = new NumericalString(ui); if (! isNumeric(ui)) {
if (!v.isNumerical) {
msg = "Veuillez entrer une valeur numérique"; msg = "Veuillez entrer une valeur numérique";
} else { } else {
valid = true; valid = true;
......
import { Component, Input, ChangeDetectorRef } from "@angular/core"; import { Component, Input, ChangeDetectorRef } from "@angular/core";
import { NumericalString } from "jalhyd"; import { isNumeric } from "jalhyd";
import { GenericInputComponent } from "../generic-input/generic-input.component"; import { GenericInputComponent } from "../generic-input/generic-input.component";
import { InternationalisationService } from "../../services/internationalisation/internationalisation.service"; import { InternationalisationService } from "../../services/internationalisation/internationalisation.service";
...@@ -61,8 +61,7 @@ export class NgParamMinComponent extends GenericInputComponent { ...@@ -61,8 +61,7 @@ export class NgParamMinComponent extends GenericInputComponent {
let valid = false; let valid = false;
let msg: string; let msg: string;
const v: NumericalString = new NumericalString(ui); if (! isNumeric(ui)) {
if (!v.isNumerical) {
msg = "Veuillez entrer une valeur numérique"; msg = "Veuillez entrer une valeur numérique";
} else { } else {
valid = true; valid = true;
......
import { Component, Input, ChangeDetectorRef } from "@angular/core"; import { Component, Input, ChangeDetectorRef } from "@angular/core";
import { NumericalString } from "jalhyd"; import { isNumeric } from "jalhyd";
import { GenericInputComponent } from "../generic-input/generic-input.component"; import { GenericInputComponent } from "../generic-input/generic-input.component";
import { InternationalisationService } from "../../services/internationalisation/internationalisation.service"; import { InternationalisationService } from "../../services/internationalisation/internationalisation.service";
...@@ -68,8 +68,7 @@ export class NgParamStepComponent extends GenericInputComponent { ...@@ -68,8 +68,7 @@ export class NgParamStepComponent extends GenericInputComponent {
let valid = false; let valid = false;
let msg: string; let msg: string;
const v: NumericalString = new NumericalString(ui); if (! isNumeric(ui)) {
if (!v.isNumerical) {
msg = "Veuillez entrer une valeur numérique"; msg = "Veuillez entrer une valeur numérique";
} else { } else {
valid = true; valid = true;
......
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