diff --git a/ruoyi-admin/src/main/resources/static/js/plugins/inputSpinner/InputSpinner.js b/ruoyi-admin/src/main/resources/static/js/plugins/inputSpinner/InputSpinner.js new file mode 100644 index 000000000..bfd52d2fb --- /dev/null +++ b/ruoyi-admin/src/main/resources/static/js/plugins/inputSpinner/InputSpinner.js @@ -0,0 +1,50 @@ +/** + * Author and copyright: Stefan Haack (https://shaack.com) + * Repository: https://github.com/shaack/bootstrap-input-spinner + * License: MIT, see file 'LICENSE' + */ + + + // the default editor for parsing and rendering +const I18nEditor = function (props, element) { + const locale = props.locale || "en-US" + + this.parse = function (customFormat) { + const numberFormat = new Intl.NumberFormat(locale) + const thousandSeparator = numberFormat.format(11111).replace(/1/g, '') || '.' + const decimalSeparator = numberFormat.format(1.1).replace(/1/g, '') + return parseFloat(customFormat + .replace(new RegExp(' ', 'g'), '') + .replace(new RegExp('\\' + thousandSeparator, 'g'), '') + .replace(new RegExp('\\' + decimalSeparator), '.') + ) + } + + this.render = function (number) { + const decimals = parseInt(element.getAttribute("data-decimals")) || 0 + const digitGrouping = !(element.getAttribute("data-digit-grouping") === "false") + const numberFormat = new Intl.NumberFormat(locale, { + minimumFractionDigits: decimals, + maximumFractionDigits: decimals, + useGrouping: digitGrouping + }) + return numberFormat.format(number) + } + } + +let triggerKeyPressed = false +const originalVal = $.fn.val +$.fn.val = function (value) { + if (arguments.length >= 1) { + for (let i = 0; i < this.length; i++) { + if (this[i]["bootstrap-input-spinner"] && this[i].setValue) { + const element = this[i] + setTimeout(function () { + element.setValue(value) + }) + } + } + } + return originalVal.apply(this, arguments) +} + diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/basic.html b/ruoyi-admin/src/main/resources/templates/demo/form/basic.html index 2988a6578..4f6e78114 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/form/basic.html +++ b/ruoyi-admin/src/main/resources/templates/demo/form/basic.html @@ -536,6 +536,14 @@
+
+ + +
+ +
+
+
diff --git a/ruoyi-admin/src/main/resources/templates/index-topnav.html b/ruoyi-admin/src/main/resources/templates/index-topnav.html index 26026cb69..690ae84c6 100644 --- a/ruoyi-admin/src/main/resources/templates/index-topnav.html +++ b/ruoyi-admin/src/main/resources/templates/index-topnav.html @@ -318,6 +318,7 @@ + diff --git a/ruoyi-admin/src/main/resources/templates/index.html b/ruoyi-admin/src/main/resources/templates/index.html index 639ec95d2..201dca946 100644 --- a/ruoyi-admin/src/main/resources/templates/index.html +++ b/ruoyi-admin/src/main/resources/templates/index.html @@ -264,6 +264,7 @@ + diff --git a/ruoyi-generator/src/main/resources/templates/tool/gen/edit.html b/ruoyi-generator/src/main/resources/templates/tool/gen/edit.html index 133fb290d..f2c61979d 100644 --- a/ruoyi-generator/src/main/resources/templates/tool/gen/edit.html +++ b/ruoyi-generator/src/main/resources/templates/tool/gen/edit.html @@ -610,6 +610,7 @@ + diff --git a/ruoyi-generator/src/main/resources/vm/html/add.html.vm b/ruoyi-generator/src/main/resources/vm/html/add.html.vm index de0f64075..51522e19c 100644 --- a/ruoyi-generator/src/main/resources/vm/html/add.html.vm +++ b/ruoyi-generator/src/main/resources/vm/html/add.html.vm @@ -62,6 +62,13 @@
+#elseif($column.htmlType == "number") +
+ +
+ +
+
#elseif($column.htmlType == "upload")
diff --git a/ruoyi-generator/src/main/resources/vm/html/edit.html.vm b/ruoyi-generator/src/main/resources/vm/html/edit.html.vm index 99f664e0b..2f68c2beb 100644 --- a/ruoyi-generator/src/main/resources/vm/html/edit.html.vm +++ b/ruoyi-generator/src/main/resources/vm/html/edit.html.vm @@ -62,6 +62,13 @@
+#elseif($column.htmlType == "number") +
+ +
+ +
+
#elseif($column.htmlType == "upload")