Skip to content

Commit

Permalink
add range
Browse files Browse the repository at this point in the history
  • Loading branch information
neferin12 committed Dec 3, 2024
1 parent fec9343 commit b32828b
Show file tree
Hide file tree
Showing 6 changed files with 261 additions and 73 deletions.
5 changes: 4 additions & 1 deletion vue-json-form/src/exampleSchemas/showcase/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
"title": "Rating",
"description": "Please rate us",
"type": "integer",
"maximum": 50
"maximum": 5,
"minimum": 0,
"step": 1,
"default": 3
},
"weekdays": {
"type": "array",
Expand Down
4 changes: 3 additions & 1 deletion vue-json-form/src/exampleSchemas/showcase/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@
{
"type": "Control",
"scope": "/properties/rating",
"options": {}
"options": {
"range": true
}
}
]
},
Expand Down
19 changes: 11 additions & 8 deletions vue-json-form/src/renderings/bootstrap/controls/NumberControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ const step = computed(() => {
</script>

<template>
<b-form-input
v-model.number="formData[savePath]"
class="vjf_input"
:id="id"
:step="step"
:min="jsonElement.minimum"
:max="jsonElement.maximum"
/>
<div>
<b-form-input
v-model.number="formData[savePath]"
class="vjf_input"
:id="id"
:step="step"
:min="jsonElement.minimum"
:max="jsonElement.maximum"
:type="layoutElement.options?.range ? 'range' : 'number'"
/>
</div>
</template>

<style scoped></style>
Loading

0 comments on commit b32828b

Please sign in to comment.