conditional options#197
Open
xavitoro wants to merge 5 commits into
Open
Conversation
johnedvard
reviewed
Feb 16, 2018
| } | ||
|
|
||
| showOption(item: any, layoutNode: any): boolean { | ||
| if (item.conditionKey !== undefined && layoutNode.options.conditionMap !== undefined) { |
There was a problem hiding this comment.
I am just wondering if it is equally correct to write if(item.conditionKey && layoutNode.options.conditionMap) skipping the !== undefined. I mean, if 0 and null are unacceptable values as well.
There was a problem hiding this comment.
I am not familiar with what is best practice. If this is the style that goes through the rest of the code in this repo, then by all means, its better to keep it this way (using !== undefined).
Contributor
|
This seems like a large change incorporating more than just conditional options. Specifically, the package.json and build changes seem like they should go into a separate PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
What changes does this PR include (check all that apply)?
[ ] Bugfix
[x ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build process changes
[ ] Documentation changes
[ ] Other... please describe:
Does this PR introduce a breaking change?
[ ] Yes
[x ] No
Any other relevant information
This change is to add conditions to select component options, now we have two ways:
Example 1:
{
"key":"[yourkey]",
"type":"select",
"titleMap": [
{ "value": [value], "name": "[name]", "conditionKey": "[conditionKey1]"},
{ "value": "K843", "name": "CODE_K843", "conditionKey": "[conditionKey1]"},
{ "value": "L843", "name": "CODE_L843", "conditionKey": "[conditionKey2]"}
],
"conditionMap": [
{
"key": "[conditionKey1]",
"condition":{
"functionBody": "[functionBody1]"
}
},
{
"key": "[conditionKey2]",
"condition":{
"functionBody": "[functionBody2]"
}
}
]
}
Example 2:
{
"key":"[yourkey]",
"type":"select",
"titleMap": [
{ "value": [value], "name": "[name]",
"condition":{
"functionBody": "[functionBody1]"
}},
{ "value": "K843", "name": "CODE_K843",
"condition":{
"functionBody": "[functionBody1]"
}},
{ "value": "L843", "name": "CODE_L843",
"condition":{
"functionBody": "[functionBody2]"
}
}
]
}