Merge branch 'master' of github.com:jean-emmanuel/open-stage-control

This commit is contained in:
jean-emmanuel 2021-05-06 14:29:29 +02:00
commit 5744b33daf
4 changed files with 21 additions and 5 deletions

View file

@ -1,11 +1,13 @@
# Changelog
## 1.9.6
## 1.9.6 (unrelease)
- bug fixes
- advanced syntaxes: `VAR{}` not updating when the default value is edited
- editor: fix "Bring to front" and "Send to back" context menu actions
- widgets
- input: add `numeric` property (allows numeric values only and displays numeric keyboard on mobile devices)
## 1.9.5

View file

@ -2,7 +2,7 @@
"name": "open-stage-control",
"productName": "Open Stage Control",
"description": "Libre and modular OSC / MIDI controller",
"version": "1.9.4",
"version": "1.9.5",
"author": {
"name": "Jean-Emmanuel Doucet",
"email": "jean-emmanuel@ammd.net"

View file

@ -20,14 +20,15 @@ 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']},
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"',
'Examples:',
'- `^[0-9]*$` accepts digits only, any number of them',
'- `/^[a-z\s]{0,10}$/i` accept between 0 and 10 alphabetic characters and spaces (case insensitive)',
]}
}
]},
},
})
}
@ -58,6 +59,9 @@ class Input extends Canvas {
this.input.addEventListener('blur', (e)=>{
this.blur(true)
})
if (this.getProp('numeric')) this.input.type = 'number'
var asYouType = this.getProp('asYouType')
if (this.getProp('validation') !== '') {
@ -93,7 +97,7 @@ class Input extends Canvas {
this.input.value = this.stringValue
this.widget.insertBefore(this.input, this.canvas)
this.input.focus()
this.input.setSelectionRange(0, this.input.value.length)
if (!this.getProp('numeric')) this.input.setSelectionRange(0, this.input.value.length)
}

View file

@ -597,6 +597,16 @@
color: var(--color-text);
}
&::-webkit-outer-spin-button,
&::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
&[type="number"] {
-moz-appearance: textfield;
}
}
}