From a04c658bb5ca4f881c0a590909d8510a8d432b16 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 17 Jan 2024 16:16:09 +0100 Subject: [PATCH] input: allow using a number in `numeric` to specify stepping value for mousewheel interaction --- CHANGELOG.md | 3 +++ src/client/widgets/basics/input.js | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d24ba64c..4783e766 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ - remote control - `/EDIT*` commands sent by a custom module are not affected by the server's `read-only` option anymore +- widgets + - input: allow using a number in `numeric` to specify stepping value for mousewheel interaction + ## 1.25.6 - bug fixes diff --git a/src/client/widgets/basics/input.js b/src/client/widgets/basics/input.js index b85a1b1a..d0d30435 100644 --- a/src/client/widgets/basics/input.js +++ b/src/client/widgets/basics/input.js @@ -20,7 +20,9 @@ class Input extends Canvas { }, class_specific: { asYouType: {type: 'boolean', value: false, help: 'Set to `true` to make the input send its value at each keystroke'}, - numeric: {type: 'boolean', value: false, help: ['Set to `true` to allow numeric values only and display a numeric keyboard on mobile devices']}, + numeric: {type: 'boolean|number', value: false, help: [ + 'Set to `true` to allow numeric values only and display a numeric keyboard on mobile devices', + 'Can be a number to specify the stepping value for mousewheel interaction (only when the input is focused).']}, validation: {type: 'string', value: '', help: [ 'Regular expression: if the submitted value doesn\'t match the regular expression, it will be reset to the last valid value.', 'If leading and trailing slashes are omitted, they will be added automatically and the flag will be set to "gm"', @@ -65,6 +67,7 @@ class Input extends Canvas { this.input.type = 'number' this.input.pattern = '[0-9\.]*' this.input.inputMode = 'decimal' + this.input.step = parseFloat(this.getProp('numeric')) || 1 } if (this.getProp('maxLength') !== '') {