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
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
Cassiopée
nghyd
Commits
232fb2a7
Commit
232fb2a7
authored
2 years ago
by
François Grand
Browse files
Options
Downloads
Patches
Plain Diff
feat: add FormulaireDefinition.parseSelectDefaultValue()
refs
#585
parent
f11b78e9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!225
Release v4.17.0
,
!193
Resolve "Restructurer Lechapt et Calmon pour de nouvelles lois de pertes de charge"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/formulaire/definition/form-definition.ts
+19
-0
19 additions, 0 deletions
src/app/formulaire/definition/form-definition.ts
src/app/formulaire/definition/form-section.ts
+2
-12
2 additions, 12 deletions
src/app/formulaire/definition/form-section.ts
with
21 additions
and
12 deletions
src/app/formulaire/definition/form-definition.ts
+
19
−
0
View file @
232fb2a7
...
...
@@ -25,6 +25,7 @@ import { ServiceFactory } from "../../services/service-factory";
import
{
SelectEntry
}
from
"
../elements/select/select-entry
"
;
import
{
SelectField
}
from
"
../elements/select/select-field
"
;
import
{
DeepSelectFieldIterator
}
from
"
../form-iterator/deep-selectfield-iterator
"
;
import
{
ConfigParser
}
from
"
./config-parser
"
;
/**
* classe de base pour tous les formulaires
...
...
@@ -146,6 +147,24 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs
Session
.
getInstance
().
deleteNub
(
sn
);
}
/**
* parse calculator JSON configuration for select default value
* @param selectId select id, ie. "id" field value
* @return select "default" field value
*/
protected
parseSelectDefaultValue
(
json
:
{},
selectId
:
string
):
string
{
const
jp
=
new
ConfigParser
(
json
);
for
(
const
fs
of
jp
.
forAll
(
"
fieldset
"
))
{
const
fsp
=
new
ConfigParser
(
fs
[
"
fields
"
]);
for
(
const
sel
of
fsp
.
forAll
(
"
select
"
))
{
if
(
sel
[
"
id
"
]
===
selectId
)
{
return
sel
[
"
default
"
];
}
}
}
return
undefined
;
}
/**
* prepare options parsing
*/
...
...
This diff is collapsed.
Click to expand it.
src/app/formulaire/definition/form-section.ts
+
2
−
12
View file @
232fb2a7
...
...
@@ -3,7 +3,6 @@ import { FieldSet } from "../elements/fieldset";
import
{
ServiceFactory
}
from
"
../../services/service-factory
"
;
import
{
IObservable
,
Session
,
SectionNub
,
Props
,
CalculatorType
,
Prop_NullParameters
,
acSection
}
from
"
jalhyd
"
;
import
{
ConfigParser
}
from
"
./config-parser
"
;
import
{
SectionType
}
from
"
jalhyd
"
;
export
class
FormulaireSection
extends
FormulaireFixedVar
{
...
...
@@ -16,17 +15,8 @@ export class FormulaireSection extends FormulaireFixedVar {
*/
private
parseDefaultSectionType
()
{
if
(
this
.
_defaultSectionType
===
undefined
)
{
const
jp
=
new
ConfigParser
(
this
.
_jsonConfig
);
for
(
const
fs
of
jp
.
forAll
(
"
fieldset
"
))
{
const
fsp
=
new
ConfigParser
(
fs
[
"
fields
"
]);
for
(
const
sel
of
fsp
.
forAll
(
"
select
"
))
{
if
(
sel
[
"
id
"
]
===
"
select_section
"
)
{
const
st
=
sel
[
"
default
"
];
this
.
_defaultSectionType
=
SectionType
[
st
];
return
;
}
}
}
const
def
=
this
.
parseSelectDefaultValue
(
this
.
_jsonConfig
,
"
select_section
"
);
this
.
_defaultSectionType
=
SectionType
[
def
];
}
}
...
...
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