Optional options in UI property control become dropdown

This commit is contained in:
Joe Knapper 2026-02-12 22:35:41 +00:00 committed by Julian Stirling
parent 89c5ea6886
commit ae81520494
4 changed files with 37 additions and 0 deletions

View file

@ -1,5 +1,20 @@
<template>
<div>
<label v-if="dataType === 'dropdown'" class="uk-form-label">
{{ label }}
<div class="input-and-buttons-container">
<select
v-model="internalValue"
class="uk-form-small numeric-setting-line-input"
@change="sendValue"
>
<option v-for="(opt, idx) in options" :key="idx" :value="opt">
{{ opt }}
</option>
</select>
<sync-property-button @click="requestUpdate" />
</div>
</label>
<label v-if="dataType == 'number'" class="uk-form-label"
>{{ label }}
<div class="input-and-buttons-container">
@ -128,6 +143,11 @@ export default {
type: Boolean,
default: null,
},
options: {
type: Array,
default: () => [],
required: false,
},
},
emits: ["requestUpdate", "sendValue", "animationShown"],
@ -182,6 +202,9 @@ export default {
return "undefined";
}
const num_types = ["integer", "float", "number"];
if (this.options && this.options.length > 1) {
return "dropdown";
}
if (num_types.includes(prop.type)) {
return "number";
}

View file

@ -4,6 +4,7 @@
:data-schema="propertyDescription"
:label="label"
:animate="animate"
:options="options"
@request-update="readProperty"
@send-value="writeProperty"
@animation-shown="resetAnimate"
@ -44,6 +45,11 @@ export default {
default: 1000,
required: false,
},
options: {
type: Array,
default: () => [],
required: false,
},
},
data() {

View file

@ -6,6 +6,7 @@
:label="propertyData.label"
:read-back="propertyData.read_back"
:read-back-delay="propertyData.read_back_delay"
:options="propertyData.options"
/>
</template>