From c17b2572c1eaa3aa7b58e145eb6a775af0764fcf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Wed, 15 Nov 2023 13:01:50 +0000
Subject: [PATCH 1/4] fix: pab-table input: fix separator (.) for decimal value
 refs #628

---
 jalhyd_branch                                 |  2 +-
 .../pab-table/pab-table.component.html        |  6 ++---
 .../pab-table/pab-table.component.ts          | 24 ++++++++++++++-----
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/jalhyd_branch b/jalhyd_branch
index de46203d5..d64531f13 100644
--- a/jalhyd_branch
+++ b/jalhyd_branch
@@ -1 +1 @@
-350-modifier-l-avertissement-de-limite-d-ennoiement-de-villemonte
+devel
diff --git a/src/app/components/pab-table/pab-table.component.html b/src/app/components/pab-table/pab-table.component.html
index d3b0c017e..733be4fb2 100644
--- a/src/app/components/pab-table/pab-table.component.html
+++ b/src/app/components/pab-table/pab-table.component.html
@@ -86,9 +86,9 @@
                     [class.select]="isSelect(cell)" [attr.rowspan]="rowSpan(cell)" [attr.colspan]="colSpan(cell)"
                     [title]="cellTitle(cell)">
 
-                    <input matInput *ngIf="isNumberInput(cell)" step="0.00000000000001" type="number" required
-                        [ngModel]="getCellValue(cell)"  (ngModelChange)="setCellValue(cell,$event)"
-                        (input)="inputValueChanged($event, cell)">
+                    <input matInput *ngIf="isNumberInput(cell)" type="text"  required 
+                        [ngModel]="getCellValue(cell)"  (ngModelChange)="setCellValue(cell,$event)" 
+                        (input)="inputValueChanged($event, cell)" (keypress) ="invalidNANInputValue($event)">
 
                     <mat-select #selectWidget *ngIf="isSelect(cell)" [value]="cell.modelValue"
                         (selectionChange)="loiDebitSelected($event, cell)">
diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts
index 8d48ab20a..897ba37c3 100644
--- a/src/app/components/pab-table/pab-table.component.ts
+++ b/src/app/components/pab-table/pab-table.component.ts
@@ -1388,12 +1388,24 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni
         return round(cell.model.singleValue, this.nDigits);
     }
 
-    public setCellValue(cell, event) {
-        try {
-            cell.model.singleValue = event
-            cell.modelValidity = undefined;
-        } catch (error) {
-            cell.modelValidity = false;
+    public setCellValue(cell, $event) { 
+        if (/^-?[0-9]*\.?[0-9]*$/g.test($event) === false) {
+         $event = $event.replace(/[^0-9\-.]/g, '');
+        }
+        if($event !== "-" && $event !== "") {
+            try {
+                cell.model.singleValue = $event;
+                cell.modelValidity = undefined;
+            } catch (error) { 
+                cell.modelValidity = false
+            } 
+        }        
+    }
+
+    public invalidNANInputValue(e: any) {
+        var rgx = /^-?[0-9]*\.?[0-9]*$/;
+        if(e.key.match(rgx) === null) {
+            e.preventDefault();
         }
     }
 
-- 
GitLab


From 29ebd650a8bebf2e68fa06c6fc610467c56175cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Wed, 15 Nov 2023 13:45:06 +0000
Subject: [PATCH 2/4] fix: specify input mode on mobile

---
 src/app/components/pab-table/pab-table.component.html | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/app/components/pab-table/pab-table.component.html b/src/app/components/pab-table/pab-table.component.html
index 733be4fb2..561ff6c24 100644
--- a/src/app/components/pab-table/pab-table.component.html
+++ b/src/app/components/pab-table/pab-table.component.html
@@ -88,7 +88,9 @@
 
                     <input matInput *ngIf="isNumberInput(cell)" type="text"  required 
                         [ngModel]="getCellValue(cell)"  (ngModelChange)="setCellValue(cell,$event)" 
-                        (input)="inputValueChanged($event, cell)" (keypress) ="invalidNANInputValue($event)">
+                        (input)="inputValueChanged($event, cell)" (keypress) ="invalidNANInputValue($event)" 
+                        pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$" inputmode="numeric"
+                        >
 
                     <mat-select #selectWidget *ngIf="isSelect(cell)" [value]="cell.modelValue"
                         (selectionChange)="loiDebitSelected($event, cell)">
-- 
GitLab


From e8ec200fc2cbe1ea6db62bdfe4b0d0d5dc682eaf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Wed, 15 Nov 2023 13:58:53 +0000
Subject: [PATCH 3/4] ci: fix runner git lab

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 92811cedb..4c09990f8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,7 +9,7 @@ stages:
   - releases-version
 
 default:
-  tags: [docker]
+  tags: [mia2]
   image: geaucassiopee/ci-cd-cross-platform-webapp:v3
 
 variables:
-- 
GitLab


From 09d0c04e2e384a80348dce0d460c93d411993dc1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Wed, 15 Nov 2023 14:39:18 +0000
Subject: [PATCH 4/4] fix: change input value pattern refs #628

---
 src/app/components/pab-table/pab-table.component.html | 2 +-
 src/app/components/pab-table/pab-table.component.ts   | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/app/components/pab-table/pab-table.component.html b/src/app/components/pab-table/pab-table.component.html
index 561ff6c24..283b07d1b 100644
--- a/src/app/components/pab-table/pab-table.component.html
+++ b/src/app/components/pab-table/pab-table.component.html
@@ -89,7 +89,7 @@
                     <input matInput *ngIf="isNumberInput(cell)" type="text"  required 
                         [ngModel]="getCellValue(cell)"  (ngModelChange)="setCellValue(cell,$event)" 
                         (input)="inputValueChanged($event, cell)" (keypress) ="invalidNANInputValue($event)" 
-                        pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$" inputmode="numeric"
+                        pattern="^-?[0-9]*\.?[0-9]*$" inputmode="numeric"
                         >
 
                     <mat-select #selectWidget *ngIf="isSelect(cell)" [value]="cell.modelValue"
diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts
index 897ba37c3..32f6b8248 100644
--- a/src/app/components/pab-table/pab-table.component.ts
+++ b/src/app/components/pab-table/pab-table.component.ts
@@ -1389,9 +1389,6 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni
     }
 
     public setCellValue(cell, $event) { 
-        if (/^-?[0-9]*\.?[0-9]*$/g.test($event) === false) {
-         $event = $event.replace(/[^0-9\-.]/g, '');
-        }
         if($event !== "-" && $event !== "") {
             try {
                 cell.model.singleValue = $event;
-- 
GitLab