Add way to set spinner step without changing HTTP API
This commit is contained in:
parent
cd14f470f6
commit
e66fe5a35a
5 changed files with 50 additions and 11 deletions
|
|
@ -27,7 +27,7 @@
|
|||
type="number"
|
||||
:min="minimum"
|
||||
:max="maximum"
|
||||
:step="step"
|
||||
:step="spinner_step"
|
||||
@input="grabFocus"
|
||||
@focusout="focusOut"
|
||||
@keydown="keyDown"
|
||||
|
|
@ -152,6 +152,11 @@ export default {
|
|||
default: null,
|
||||
required: false,
|
||||
},
|
||||
step: {
|
||||
type: Number,
|
||||
default: null,
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
|
||||
emits: ["requestUpdate", "sendValue", "animationShown"],
|
||||
|
|
@ -253,8 +258,17 @@ export default {
|
|||
if (this.dataType !== "number") return undefined;
|
||||
return this.dataSchema.minimum;
|
||||
},
|
||||
step() {
|
||||
/**
|
||||
* The step size for numerical spinners.
|
||||
*
|
||||
* If not a number this is `undefined`. If `step` is set as a prop then it is used
|
||||
* otherwise `multipleOf` from the property `dataSchema` is used. If `multipleOf`
|
||||
* is not set in the `dataSchema` JS will return `undefined` and the browser will
|
||||
* use its default value.
|
||||
*/
|
||||
spinner_step() {
|
||||
if (this.dataType !== "number") return undefined;
|
||||
if (this.step !== null) return this.step;
|
||||
return this.dataSchema.multipleOf;
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
:label="label"
|
||||
:animate="animate"
|
||||
:options="options"
|
||||
:step="step"
|
||||
@request-update="readProperty"
|
||||
@send-value="writeProperty"
|
||||
@animation-shown="resetAnimate"
|
||||
|
|
@ -50,6 +51,11 @@ export default {
|
|||
default: null,
|
||||
required: false,
|
||||
},
|
||||
step: {
|
||||
type: Number,
|
||||
default: null,
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
:read-back="propertyData.read_back"
|
||||
:read-back-delay="propertyData.read_back_delay"
|
||||
:options="propertyData.options"
|
||||
:step="propertyData.step"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue