mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-12 16:14:58 +08:00
Fix negative numbers on filters and item card [SCI-11749]
This commit is contained in:
parent
9b6f1ff631
commit
0af24169a3
2 changed files with 3 additions and 10 deletions
|
@ -75,7 +75,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
validateNumber(number) {
|
||||
return number.replace(/[^0-9.]/g, '').match(/^\d*(\.\d{0,10})?/)[0];
|
||||
return number.replace(/[^0-9.-]/g, '').match(/^-?\d*(\.\d{0,10})?/)[0];
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -81,11 +81,6 @@ export default {
|
|||
this.toggleExpandableState();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
canEdit() {
|
||||
return this.permissions?.can_manage && !this.inArchivedRepositoryRow;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleKeydown(event) {
|
||||
if (event.key === 'Enter') {
|
||||
|
@ -115,8 +110,6 @@ export default {
|
|||
});
|
||||
},
|
||||
enableEdit(e) {
|
||||
if (!this.canEdit) return;
|
||||
|
||||
if (e && $(e.target).hasClass('atwho-user-popover')) return;
|
||||
if (e && $(e.target).hasClass('sa-name')) return;
|
||||
if (e && $(e.target).hasClass('sa-link')) return;
|
||||
|
@ -146,8 +139,8 @@ export default {
|
|||
});
|
||||
},
|
||||
enforceNumberInput() {
|
||||
const regexp = this.decimals === 0 ? /[^0-9]/g : /[^0-9.]/g;
|
||||
const decimalsRegex = new RegExp(`^\\d*(\\.\\d{0,${this.decimals}})?`);
|
||||
const regexp = this.decimals === 0 ? /[^0-9-]/g : /[^0-9.-]/g;
|
||||
const decimalsRegex = new RegExp(`^-?\\d*(\\.\\d{0,${this.decimals}})?`);
|
||||
let { value } = this;
|
||||
value = value.replace(regexp, '');
|
||||
value = value.match(decimalsRegex)[0];
|
||||
|
|
Loading…
Add table
Reference in a new issue