Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
cassiopee
nghyd
Commits
1827d10a
Commit
1827d10a
authored
May 12, 2022
by
Grand Francois
Browse files
feat: validate variable parameter mode dialog with enter key (and cancel with escape)
refs
#541
parent
33ebb9bb
Pipeline
#36082
passed with stages
in 17 minutes and 30 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.html
View file @
1827d10a
...
...
@@ -23,7 +23,7 @@
<input
matInput
class=
"form-control"
type=
"number"
inputmode=
"numeric"
name=
"min-value"
step=
"0.01"
[placeholder]=
"uitextValeurMini"
[(ngModel)]=
"minValue"
#min
="
ngModel
"
name=
"min"
(input)=
"minMaxForm.controls.max.updateValueAndValidity()"
[appJalhydModelValidationMin]=
"param"
required
pattern=
"^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$"
>
required
pattern=
"^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$"
(keyup.enter)=
"onValidate()"
(keyup.escape)=
"onCancel()"
>
<mat-error
*ngIf=
"min.errors"
>
<div
*ngIf=
"min.errors.required || min.errors.pattern"
>
...
...
@@ -39,7 +39,7 @@
<input
matInput
class=
"form-control"
type=
"number"
inputmode=
"numeric"
name=
"max-value"
step=
"0.01"
[placeholder]=
"uitextValeurMaxi"
[(ngModel)]=
"maxValue"
#max
="
ngModel
"
name=
"max"
(input)=
"minMaxForm.controls.min.updateValueAndValidity()"
[appJalhydModelValidationMax]=
"param"
required
pattern=
"^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$"
>
required
pattern=
"^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$"
(keyup.enter)=
"onValidate()"
(keyup.escape)=
"onCancel()"
>
<mat-error
*ngIf=
"max.errors"
>
<div
*ngIf=
"max.errors.required || max.errors.pattern"
>
...
...
@@ -54,7 +54,8 @@
<mat-form-field>
<input
matInput
class=
"form-control"
type=
"number"
inputmode=
"numeric"
name=
"step-value"
step=
"0.01"
[placeholder]=
"uitextPasVariation"
[(ngModel)]=
"stepValue"
#step
="
ngModel
"
name=
"step"
[appJalhydModelValidationStep]=
"param"
required
pattern=
"^([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$"
>
[appJalhydModelValidationStep]=
"param"
required
pattern=
"^([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$"
(keyup.enter)=
"onValidate()"
(keyup.escape)=
"onCancel()"
>
<mat-error
*ngIf=
"step.errors"
>
{{ uitextMustBePositive }}
...
...
@@ -128,4 +129,4 @@
{{ uitextValidate }}
</button>
</div>
</div>
\ No newline at end of file
</div>
src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts
View file @
1827d10a
...
...
@@ -290,20 +290,22 @@ export class DialogEditParamValuesComponent implements OnInit {
}
public
onValidate
()
{
switch
(
this
.
param
.
valueMode
)
{
case
ParamValueMode
.
LISTE
:
this
.
data
.
param
.
setValueList
(
this
,
this
.
param
.
valueList
);
break
;
case
ParamValueMode
.
MINMAX
:
this
.
data
.
param
.
setMinValue
(
this
,
this
.
param
.
minValue
);
this
.
data
.
param
.
setMaxValue
(
this
,
this
.
param
.
maxValue
);
this
.
data
.
param
.
setStepValue
(
this
,
this
.
param
.
stepValue
);
break
;
if
(
this
.
isFormValid
)
{
switch
(
this
.
param
.
valueMode
)
{
case
ParamValueMode
.
LISTE
:
this
.
data
.
param
.
setValueList
(
this
,
this
.
param
.
valueList
);
break
;
case
ParamValueMode
.
MINMAX
:
this
.
data
.
param
.
setMinValue
(
this
,
this
.
param
.
minValue
);
this
.
data
.
param
.
setMaxValue
(
this
,
this
.
param
.
maxValue
);
this
.
data
.
param
.
setStepValue
(
this
,
this
.
param
.
stepValue
);
break
;
}
this
.
dialogRef
.
close
({
cancelled
:
false
});
}
this
.
dialogRef
.
close
({
cancelled
:
false
});
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment