From c9ab5c23eab77cbb92fb717cab9671fa45cdd35d Mon Sep 17 00:00:00 2001 From: Ryan Huffman <ryanhuffman@gmail.com> Date: Thu, 6 Dec 2018 15:30:11 -0800 Subject: [PATCH] Add support for min/max/step/defaultValue on number field --- scripts/system/html/js/entityProperties.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 972c5f63be..cfead83851 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -1533,6 +1533,11 @@ function resetProperties() { case 'number': case 'string': { property.elInput.value = ""; + if (propertyData.defaultValue !== undefined) { + property.elInput.setValue(propertyData.defaultValue); + } else { + property.elInput.setValue(""); + } break; } case 'bool': { @@ -1889,6 +1894,18 @@ function createNumberProperty(property, elProperty) { ${propertyData.readOnly ? 'readonly' : ''}></input> `) + if (propertyData.min !== undefined) { + elInput.setAttribute("min", propertyData.min); + } + if (propertyData.max !== undefined) { + elInput.setAttribute("max", propertyData.max); + } + if (propertyData.step !== undefined) { + elInput.setAttribute("step", propertyData.step); + } + if (propertyData.defaultValue !== undefined) { + elInput.value = propertyData.defaultValue; + } elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(property));