Display the steps for inputs of type range

Fix #877
This commit is contained in:
David Larlet 2023-05-18 14:20:46 -04:00
parent d0f89c3be2
commit 6156993536
2 changed files with 24 additions and 0 deletions

View file

@ -512,6 +512,13 @@ i.info {
.umap-browse-datalayers { .umap-browse-datalayers {
padding: 0 10px; padding: 0 10px;
} }
.umap-field-datalist {
display: flex;
justify-content: space-between;
font-size: 9px;
margin-top: -8px;
padding: 0 5px;
}
.umap-form-iconfield { .umap-form-iconfield {
position: relative; position: relative;
overflow: hidden; overflow: hidden;

View file

@ -801,6 +801,23 @@ L.FormBuilder.Range = L.FormBuilder.Input.extend({
value: function () { value: function () {
return L.DomUtil.hasClass(this.wrapper, 'undefined') ? undefined : this.input.value return L.DomUtil.hasClass(this.wrapper, 'undefined') ? undefined : this.input.value
}, },
buildHelpText: function () {
var datalist = L.DomUtil.create(
'datalist',
'umap-field-datalist',
this.getHelpTextParent()
)
datalist.id = `range-${this.options.label}`
this.input.setAttribute('list', datalist.id)
var options = ''
for (var i = this.options.min; i <= this.options.max; i += this.options.step) {
options += `<option value="${i.toPrecision(2)}" label="${i.toPrecision(
2
)}"></option>`
}
datalist.innerHTML = options
},
}) })
L.FormBuilder.ManageOwner = L.FormBuilder.Element.extend({ L.FormBuilder.ManageOwner = L.FormBuilder.Element.extend({