Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nghyd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Cassiopée
nghyd
Commits
d629e36b
Commit
d629e36b
authored
5 years ago
by
David Dorchies
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitlab-ssh.irstea.fr:cassiopee/nghyd
parents
3300d19a
4fafedd2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/formulaire/fieldset.ts
+27
-16
27 additions, 16 deletions
src/app/formulaire/fieldset.ts
with
27 additions
and
16 deletions
src/app/formulaire/fieldset.ts
+
27
−
16
View file @
d629e36b
...
...
@@ -88,8 +88,24 @@ export class FieldSet extends FormulaireElement implements Observer {
return
this
.
nub
.
properties
;
}
private
getPropValue
(
key
:
string
):
any
{
return
this
.
properties
.
getPropValue
(
key
);
private
get
sectionProperties
():
Props
{
const
section
=
this
.
nub
.
getChildren
()[
0
];
if
(
section
)
{
return
section
.
properties
;
}
else
{
return
new
Props
();
}
}
/**
* @param inSection if true, will look for the required property in the Nub's section (children[0])
*/
private
getPropValue
(
key
:
string
,
inSection
:
boolean
=
false
):
any
{
if
(
inSection
)
{
return
this
.
sectionProperties
.
getPropValue
(
key
);
}
else
{
return
this
.
properties
.
getPropValue
(
key
);
}
}
public
setPropValue
(
key
:
string
,
val
:
any
):
boolean
{
...
...
@@ -195,21 +211,12 @@ export class FieldSet extends FormulaireElement implements Observer {
case
"
fs_ouvrage
"
:
this
.
setSelectValueFromProperty
(
"
select_structure
"
,
"
structureType
"
);
const
st
:
StructureType
=
this
.
getPropValue
(
"
structureType
"
);
switch
(
st
)
{
case
StructureType
.
SeuilRectangulaire
:
this
.
setSelectValueFromProperty
(
"
select_loidebit
"
,
"
loiDebit
"
);
break
;
case
StructureType
.
VanneRectangulaire
:
this
.
setSelectValueFromProperty
(
"
select_loidebit
"
,
"
loiDebit
"
);
break
;
}
this
.
setSelectValueFromProperty
(
"
select_loidebit
"
,
"
loiDebit
"
);
break
;
case
"
fs_section
"
:
this
.
setSelectValueFromProperty
(
"
select_section
"
,
"
nodeType
"
);
// property nodeType is stored in the section, not in the parent Nub
this
.
setSelectValueFromProperty
(
"
select_section
"
,
"
nodeType
"
,
true
);
break
;
case
"
fs_param_calc
"
:
...
...
@@ -225,11 +232,15 @@ export class FieldSet extends FormulaireElement implements Observer {
/**
* Reflects a property value in the interface, through the value of a <select> field, if this select exists
* @param inSection if true, will look for the required property in the Nub's section (children[0])
*/
private
setSelectValueFromProperty
(
selectId
:
string
,
propertyKey
:
string
)
{
private
setSelectValueFromProperty
(
selectId
:
string
,
propertyKey
:
string
,
inSection
:
boolean
=
false
)
{
const
selectField
:
SelectField
=
this
.
getFormulaireNodeById
(
selectId
)
as
SelectField
;
if
(
selectField
)
{
const
propVal
:
any
=
this
.
getPropValue
(
propertyKey
);
let
propVal
:
any
=
this
.
getPropValue
(
propertyKey
,
inSection
);
if
(
propVal
===
undefined
)
{
propVal
=
""
;
// clodo bullet-proof loading
}
const
selectElement
=
selectField
.
getSelectedEntryFromValue
(
propVal
);
try
{
selectField
.
setValue
(
selectElement
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment