|
70 | 70 | <ScrollPanel class="h-full"> |
71 | 71 | <Fieldset legend="Input parameters"> |
72 | 72 | <InputWidget |
73 | | - v-for="(input, index) in (uiJson as any).input" |
| 73 | + v-for="(input, index) in uiJson.input" |
74 | 74 | v-model="interactiveInputValues[index]!" |
75 | 75 | v-show="interactiveShowInput[index]" |
76 | 76 | :key="`input_${index}`" |
77 | 77 | :name="input.name" |
78 | | - :maximumValue="input.maximumValue" |
79 | | - :minimumValue="input.minimumValue" |
80 | | - :possibleValues="input.possibleValues" |
81 | | - :stepValue="input.stepValue" |
| 78 | + :maximumValue="isScalarInput(input) ? input.maximumValue : undefined" |
| 79 | + :minimumValue="isScalarInput(input) ? input.minimumValue : undefined" |
| 80 | + :possibleValues="isDiscreteInput(input) ? input.possibleValues : undefined" |
| 81 | + :stepValue="isScalarInput(input) ? input.stepValue : undefined" |
82 | 82 | :class="index !== 0 ? 'mt-6' : ''" |
83 | 83 | @change="updateInteractiveSimulation" |
84 | 84 | /> |
|
88 | 88 | <div class="flex flex-col grow gap-2 h-full min-h-0"> |
89 | 89 | <IssuesView v-show="interactiveInstanceIssues.length !== 0" :leftMargin="false" :width="width" :height="actualHeight" :issues="interactiveInstanceIssues" /> |
90 | 90 | <GraphPanelWidget v-show="interactiveInstanceIssues.length === 0" |
91 | | - v-for="(_plot, index) in (uiJson as any).output.plots" |
| 91 | + v-for="(_plot, index) in uiJson.output.plots" |
92 | 92 | :key="`plot_${index}`" |
93 | 93 | class="flex-1 w-full min-h-0" |
94 | 94 | :margins="interactiveCompMargins" |
@@ -175,6 +175,16 @@ function populateParameters(parameters: vue.Ref<string[]>, instanceTask: locSedA |
175 | 175 | parameters.value.sort((parameter1: string, parameter2: string) => parameter1.localeCompare(parameter2)); |
176 | 176 | } |
177 | 177 |
|
| 178 | +// Type guards. |
| 179 | +
|
| 180 | +function isScalarInput(input: locApi.IUiJsonInput): input is locApi.IUiJsonScalarInput { |
| 181 | + return 'maximumValue' in input && 'minimumValue' in input; |
| 182 | +} |
| 183 | +
|
| 184 | +function isDiscreteInput(input: locApi.IUiJsonInput): input is locApi.IUiJsonDiscreteInput { |
| 185 | + return 'possibleValues' in input; |
| 186 | +} |
| 187 | +
|
178 | 188 | // Standard mode. |
179 | 189 |
|
180 | 190 | const standardDocument = props.file.document(); |
|
0 commit comments